Template Metaprogramming Made Easy (Huh?)
bearophile
bearophileHUGS at lycos.com
Tue Sep 8 15:09:01 PDT 2009
Justin Johansson:
>D is to C++ as Scala is to Java.<
Scala allows to write shorter programs compared to Java ones, is more flexible and more complex than Java.
D2 is less complex than C++, it's a bit less verbose than C++, and a bit less flexible than C++.
(Both Scala and D add some functional sides to their older languages. Scala is currently more functional-friendly than D2).
Paul Graham:
>static typing seems to preclude true macros<
Paul knows Lisp well, but I don't believe in that statement. I'll read more about this.
>If I'm not mistaken, (LISP) macros**, metaprogramming, templates are different views of the same thing<
Lisp macros are quite more powerful than C++-style templates.
Time ago Walter was interested in adding AST (compile-time only) macros to D, but I think he's not interested in adding them any more.
> ** 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.<
CLisp macros are not pure at all, Scheme macros are a bit less dirty :-)
>I don't end up becoming disillusioned with D as I did with Scala.<
I don't program in Scala, and overall it's probably not my ideal language at all, but I think it's a cute language (and the JavaVM it runs on has some good things, like its GCs, some inlining/profiling code, etc), and I believe it has some lessons to teach to D developers. Can you tell me/us why you think Scala was not good enough for you?
Bye,
bearophile
More information about the Digitalmars-d
mailing list