Either I'm just too stupid, or D is lacking something
Andrei Khropov
andkhropov at nospam_mtu-net.ru
Fri Jul 28 04:32:05 PDT 2006
Wolfgang Draxinger wrote:
> Tom S wrote:
>
> >
> http://lists.puremagic.com/pipermail/digitalmars-d/2006-July/005564.html
> > It wouldn't need new special characters, just one new keyword
> > and it could allow for some more magic.
>
> I don't know. I understand what you mean by it, but that mixes up
> runtime types with compiletime tokens.
That's the idea of templates - you can parametrize them by compile-time known
literals of different types (Type, float, int, char[]...).
I think 'char[]' is no worse than others. Why not extend its capabilities?
> In interpreted languages
> this would be done by some builtin eval(...) or compile(...)
> function. But D is a compiles language and I think, that any
> metaprogramming structures clearly separate compiletime and
> runtime stuff. And let's face it: char[] is a runtime type, that
> takes most of it's guts from phobos implementation of Arrays,
> with some additional sugar to support UTF. I think it should be
> made clear that such a "identifier parameter" is something
> special not to be mistaken for a runtime template parameter.
It maybe of some interest to you how metaprogramming is performed in Nemerle
which is a compiled language but allows arbitrary code in metaprograms
(they call them macros there):
http://nemerle.org/Macros
http://nemerle.org/Macros_tutorial
I would like to see comparable power in D metaprogramming.
--
AKhropov
More information about the Digitalmars-d
mailing list