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

Re: <boolean> (was Re: object-class)

>   ...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)....
>Elegant, perhaps, but what does it add to the ease of reading or
>writing programs, or even to the ease of defining Dylan's semantics?
>	-s
Take a look at Smalltalk and Self and see what you think.

You can always make the programs easier to read by introducing syntactic
sugar for lambda creation, which is what Smalltalk and Self do.
In Smalltalk you construct a zero-arg lambda by writing statements inside [ ]

	a > b ifTrue: [a] ifFalse: [b]
		      ^             ^ lambda that returns b
		      ^ lambda that returns a

>writing programs, or even to the ease of defining Dylan's semantics?
Its clearly easier to define new control semantics with this approach.
One no longer needs to augment the compiler to do so.

Thats not the same thing as having a small, concise definition of control
semantics.  In Smalltalk & Self control semantics are spread throughout
several relevant classes.

The point is that if a subset of the language has the expressive power to
implement parts of the language outside thsi subset then the language is
overspecified.  There are good reasons (such as efficiency) for doing this,
but its not necessary.

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)