[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: <boolean> <true> & <false>



>
>>   ...If you have separate classes for true & false then its possible
>>   to define the basic control structures using polymorphism on #t &
>>   #f and lambda (method)....
>
>While this is a simplification in theory, I don't think it would simplify
>the practice of programming in Dylan.  It might be different in Self and
>Smalltalk.
>
>If you allow the user to define methods on IF, then it also makes things
>much harder for the compiler.
>
>   -Andrew
>
I'm not sugesting one replace the IF special form by methods.  The
compiler can in-line the Smalltalk-style methods/lambda version of IF, but then
debugging the code reveals that the compiler has treated the IF message
specially.  So if one is concerned about efficiency then use hard-wired control
structures.  

My feeling is that if you introduce a class <boolean> which allows
you to specialise methods on <boolean> and non-<boolean> you should introduce
<true> & <false>, since its likely you will want to specialise methods on
<true> & <false>.

-- 
Eliot Miranda,  Lecturer	email:	eliot@dcs.qmw.ac.uk
Department of Computer Science	ARPA:	eliot%dcs.qmw.ac.uk@nsf.ac.uk
Queen Mary Westfield College	UUCP:	eliot@qmw-dcs.uucp
Mile End Road, LONDON E1 4NS	Tel:	071 975 5229 (+44 71 975 5229)
				Fax:	081 980 6533 (+44 81 980 6533)