Duane Rettig <email@example.com> wrote:
| ... most programming languages have completely ignored the concept
| of treating code as data. Only assembler languages and some lisp-like
| languages support the concept.
| An example: What is the real difference between expanding a macro
| in C and in Common Lisp? Answer: In C, the compiler does all of
| the work; the resulting expanded code is in the form of text, and
| there is no run-time possibility of modification of the code.
| In other words, the code is treated as code, and never data.
Another similarity between Lisp & *older* assemblers such as MACRO-10
on the PDP-10 (not the brain-dead modern assemblers that are little more
than backends for C) is that they had extensive [I'd say "Turing-complete",
except for the expected flamage!] programmability during the expansion
process. MACRO-10 was especially nice, since you could store "state" in
assembly-time variables *and* mutate it later. You could do arithmetic,
do numerically-controlled loops, loops over arguments, loops over
*characters* of arguments, unfold nested structure in arguments,
convert numbers to string, contruct new assembly-time variables by
concatenation, and then store into and mutate *those*, etc.
I think I have written here before about some macros I used circa 1971
(in the FOCAL-10 interpreter, a port of PDP-8 FOCAL/F to the PDP-10)
to incrementally declare table-lookup "bit strips" for lexical parsing,
then drop the filled-in packed tables at the end of the program.
Yes, Lisp macros are nicer still (the "bit strip" stuff would be trivial),
but those older assemblers *were* something to write home about... ;-} ;-}
Rob Warnock, 8L-846 firstname.lastname@example.org
Applied Networking http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. FAX: 650-933-0511
Mountain View, CA 94043 PP-ASEL-IA