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

Re: how expressive are they?




> >    x and: [y] and: [z]
> >    x ifTrue: [y] ifFalse: [z]
> >    
> > And see how much wordier these are than (AND x y z) and (IF x y z).

They are only wordy because Smalltalk has some longish function names.
You can define shorter ones if you like. That is totally irrelevant to
the general question of whether macros are powerful.

To step back a bit, consider how wonderful functions are. Anyone
remember working in a language, like old Basics if you don't use gosub,
that didn't have functions? It's really, really hard to write programs
without functions.

Guy's parodies are instructive, because they make you think about what
you could afford to lose. Losing algebraic syntax (as opposed to
Lisp-style arithmetic) is not too painful. Losing classes is a bit more
painful. Losing functions makes programming very difficult indeed. So
where do macros fit in this order?

What I'd like to see is an example of a program, in a language with easy
syntax for assignment and blocks, where rewriting it without any
user-defined macros would be similarly painful. Several people so far
have asserted that macros are essential, but we've only seen weak
examples where they save you some ' and [] characters, and arguably at
the expense of some clarity.

-- 
Trevor Blackwell      tlb@anybots.com       (650) 776-7870