Unification and extension of compile-time reflection
Jarrett Billingsley
jarrett.billingsley at gmail.com
Tue Nov 25 07:12:48 PST 2008
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
}
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