Either I'm just too stupid, or D is lacking something

Tom S h3r3tic at remove.mat.uni.torun.pl
Fri Jul 28 04:10:28 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. 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.

I wouldn't say that char[] is a 'runtime' type. It's a perfectly legit 
template specialization parameter. It might be runtime-only in other 
languages, like C++. D gives us more power - power to use string 
literals as template specializations. Extending this feature (e.g. in 
the way I proposed it) might yield even more powerful metaprogramming 
facilities.


--
Tomasz Stachowiak



More information about the Digitalmars-d mailing list