Dwight Hughes dwighth@ipa.net wrote:
False defines the behavior of its single instance, false -- logical negation. Notice how the truth-value checks become direct message sends, without the need for explicit testing.
Be aware however that most of these methods are not sent as real messages in normal use. Most are inline coded by the compiler as test and jump bytecodes - avoiding the overhead of the full message sends. So simply redefining these methods here will have no effect.
If you want to actually send them as messages, you will need to send them using #perform:with: and #perform:with:with:.
Looks cool. Arguably, though, a better way to call the relevant methods for real is to tell the compiler to stop inlining them, and then to recompile everything. There's no point in calling them with #perform: etc unless you have actually changed them, and if you have actually changed them, then you probably want the whole system to enjoy the modifications.
So maybe we should just leave in the warning and leave out the circumvention.
Oh yeah, and this is true for both True and False. So maybe we should just put this stuff in class Boolean, instead of duplicating it in two places.
Lex
When commenting classes (I really like that CCC movement), I'd suggest to mostly omit implementation details, code critics or discussions of alternatives.
So the False's class comment is right in warning people that its methods have no senders. It might even give a hint how to use them but that's enough.
Oh yeah, and this is true for both True and False. So maybe we should just put this stuff in class Boolean, instead of duplicating it in two places.
Even more important IMHO is to always thing about that when reading a comment it should be self contained. That means we don't want to move parts of the comment to the superclass only because that part is true for multiple subclasses. If the part is really large, we might thing about an explicit "see superclass for more details" but othervise, I'd vote to a small redundancy in favor for comments you can understand without knowing the context. Keep in mind, the comment is for references not just a part of a larger explaination.
bye -- Stefan Matthias Aust // Bevor wir fallen, fallen wir lieber auf.
squeak-dev@lists.squeakfoundation.org