Three Value Logic

Raab, Andreas Andreas.Raab at disney.com
Thu Dec 9 03:54:36 UTC 1999


> The VM doesn't appear to allow this to happen.  In fact, even creating a
> subclass of Object which implements #and: #or: etc seems to fall foul of
> the VM ("Non-Boolean Receiver - proceed for truth").
> 
> Is there any way to get round this?  Do I have to rename all of the
> logic/control methods (ie something myAnd: [someblock])?

There is a way - though it'll cost you *lots* of cycles. You could modify
the Compiler not to inline #and: and #or: and generate message sends instead
(you would have to modify several methods in MessageNode category 'macro
transformations'). Then, you could go on and recompile the entire system (to
get rid of the original transformations; cross your fingers that you didn't
do a mistake...). It'll slow you down *heavily* but it'll allow you to make
a new subclass of Boolean and implement #and: and #or: the way you want it
(as well as #ifTrue:ifFalse: if you'd like, heh, heh).

Now the question is if that's really worth doing ... but I leave the answer
up to you ;-)

  Andreas





More information about the Squeak-dev mailing list