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

RE: how expressive are they?




On Fri, 22 Nov 2002, Anton van Straaten wrote:

> > x ifTrue: [y] ifFalse: [z]
> > x ifFalse: [y] ifTrue: [z]
> > x ifNil: [y]
> > x ifNotNil: [y]
> > x ifNil: [y] ifNotNil: [z]
>
> Yeah.  Now if only we could come up with a system that would allow us to
> factor out all those brackets and colons - perhaps some kind of syntactic
> transformation...??

Why?  On this small scale, I think Smalltalk's syntax hits the sweet spot.
The brackets can't be factored out, because I might have a pre-existing
block that I wanted to pass in (as opposed to a block literal).
Factoring out the colons would presumably require introducing parentheses,
or indentation-based syntax, or something equivalent.

I think macros are wonderful, but on a large scale (embedding DSLs,
describing many function or class definitions in a few lines, implementing
object systems), not as a way to make individual expressions more concise.

Avi