Is metaprogramming useful?

Brad Anderson brad at dsource.org
Wed Nov 29 12:57:03 PST 2006


Steve Horne wrote:
> On Wed, 29 Nov 2006 14:11:01 -0500, Brad Anderson <brad at dsource.org>
> wrote:
> 
>> Steve Horne wrote:
> 
>>> There are things you just can't do with Scheme macros. Associativity
>>> and precedence, for instance. This means that if you want to do these
>>> things, you have to go the Von Neumann route - treat code as data and
>>> manipulate it at compile time using Scheme functions.
>> I'm not following.  Do you have definitions or examples of these?
> 
> No, but it's implicit in the subset of the Scheme language that I
> understand.

Okay, I have worked with Common Lisp, and not much with Scheme.  Although for
Scheme, I've done a bit while reading Structure and Interpretation of Computer
Programs, an excellent book.

> 
> The term to look up is 'quoting'. A quoted expression may look like
> code, but to Scheme it is just a list of tokens. You pass that list as
> a parameter to a function that can make sense of it, and you have a
> new language extension. And the translation should happen at compile
> time, though at this point we are running into the limits of my
> knowledge of Scheme.
> 
>> http://lambda-the-ultimate.org/node/1605
> 
> I can't seem to access that ATM, but I'll give it another go later.
> 
> Going purely on the URL, though, lambdas (first class functions)
> aren't really the issue here. It's a powerful tool - one thats widely
> imitated these days - but it isn't a metaprogramming thing.
> 

Understood.  lambda-the-ultimate.org is a programming language discussion
site, iirc.  Here's the google cache:

http://216.239.51.104/search?q=cache:o2sGhHoc57cJ:lambda-the-ultimate.org/node/1605+lisp+associativity&hl=en&gl=us&ct=clnk&cd=6

BA



More information about the Digitalmars-d mailing list