On Thu, 13 Oct 2005, Peter da Silva wrote:

> OK: in Smalltalk, Postscript, Lisp, Forth, and most other languages that
> are aggressively introspective and reflective, control structures are
> defined in terms of operations that can be performed within the language.
>
> They may be implemented in the compiler or interpreter in a more efficient
> way, but that's an implementation detail. In practice you could build
> them out of other control structures and blocks if you wanted to.
>
> Smalltalk:
>       (expression) ifTrue: [ block ] ifFalse: [ block ].
>
> Postscript:
>       expression { block } { block } ifelse
>
> Lisp:
>       (cond (expression code)
>             (expression code)
>             (expression code)
>             (t code))
>
> Forth is a bit harder to see, but you can take my word for it that it's
> got the same kind of capability to implement new control structures.
>
> Basically, if you can implement control structures this way, then it's
> inelegant to define them such that they don't work as if they're implemented
> this way, this allowing them to be replaced or extended cleanly. Since
> nobody would ever leave inelegant components in a language ...

Every time I'm convinced I understand this, I immediately think that I
don't.

I have a simplistic understanding of, for instance, how one can define
control structures within the language, rather than having to hard-code them
into the parser.  I just don't understand how one can easily recognize
whether a language supports this feature.

-- 
The great tragedy of Science - the slaying of a beautiful hypothesis by
an ugly fact.   --Thomas H. Huxley
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

Reply via email to