Template Metaprogramming Made Easy (Huh?)

language_fan foo at bar.com.invalid
Wed Sep 9 11:33:34 PDT 2009


Tue, 08 Sep 2009 17:25:08 -0400, Justin Johansson thusly wrote:

> D is to C++ as Scala is to Java.

The word you are looking for may be 'successor'.

> The very articulate Paul Graham writes in "The Hundred-Year Language"
> http://www.paulgraham.com/hundred.html "Though the situation is better
> in the sciences, the overlap between the kind of work you're allowed to
> do and the kind of work that yields good languages is distressingly
> small. ... types seem to be an inexhaustible source of research papers,
> despite the fact that static typing seems to preclude true macros--
> without which, in my opinion, no language is worth using." If I'm not
> mistaken, (LISP) macros**, metaprogramming, templates are different
> views of the same thing and any language which makes template
> metaprogramming easy is definitely worth it. ** Yes I know, there is
> nothing as pure as LISP macros but since I tend to lead a rather impure
> life 'D' has my attention now.

I do not know what is so pure in LISP's macros. Macro is a "pure" 
evaluation function that takes a meta-program and outputs another program 
that can be compiled to an executable (or interpreted). The larger 
difference is that macros in LISP are cleaner since they allow modifying 
all code as data. The lack of type system is another thing. A type system 
for meta-language has non-trivial requirements and I have to say that the 
most general system in D (string mixins) is not that large an improvement 
over LISP's macros. Go and see how template haskell did the same..

> Given Martin Odersky awarded top ACM recognition
> http://actualites.epfl.ch/index.php?
module=procontent&func=display&id=2046
> for Scala, FP etc, perhaps Walter Bright should be considered for a
> Fields Medal for D :-) http://en.wikipedia.org/wiki/Fields_Medal

Martin is a computer scientist, Walter is an engineer. Martin creates new 
science, Walter just applies existing knowledge. Those awards are only 
meant for real scientists - engineers have their own award systems.



More information about the Digitalmars-d mailing list