Unification and extension of compile-time reflection

Nick Sabalausky a at a.a
Tue Nov 25 14:17:28 PST 2008


"Jarrett Billingsley" <jarrett.billingsley at gmail.com> wrote in message 
news:mailman.56.1227629961.22690.digitalmars-d at puremagic.com...
> On Tue, Nov 25, 2008 at 3:56 AM, Aarti_pl <aarti at interia.pl> wrote:
>> I completely agree that compile time introspection in D is very messy.
>>
>> There are some other problems with CT introspection, which I have 
>> explained
>> in my post some time ago:
>> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=77654
>>
>> In the same post I also proposed unified syntax for template 
>> specialization,
>> static if, static assert and alias, while dropping completely is()
>> expression for templates. Basically my proposal is about extending 
>> template
>> pattern matching.
>>
>> You have touched few other areas which needs to be rethought. But I think
>> that just using traits will not work very good. It will be too explicit 
>> e.g.
>>
>> Your proposal:
>> static if(is(traits(isAssociativeArray, T))) {
>>  traits(associativeArrayKeyType, K);
>>  traits(associativeArrayValueType, V);
>> }
>>
>> Compared to my proposal:
>> static if (T V K : V[K]) {
>>  //V and K is already defined here
>> }
>>
>> Anyway merging these two proposals will improve situation significantly.
>
> Ahh, nonono, I proposed keeping is() but only as syntactic sugar for
> traits() magic.  So under my proposal one would be able to do:
>
> static if(is(T : V[K], K, V))
> {
>   // V and K are defined here
> }
>

I think his "eliminate is()" proposal was about turning the above into 
something like this:

static if(T : V[K], K, V)

instead of eliminating what is() does.

> Except that it would just be _implemented_ using traits.  :)
>
>> BTW. I also hate underscores in keywords. :-P
>
> They are the devil! 





More information about the Digitalmars-d mailing list