On Wed, 30 Mar 2011 22:28:27 +0300, Ary Manzana <a...@esperanto.org.ar> wrote:

I think :: is not used in the language.

In a recent article about D I saw:

mixin(__traits(identifier, T) ~ " " ~
       to!string(tolower(__traits(identifier, T)[0])) ~
       __traits(identifier, T)[1..$] ~ ";");

What if foo::bar were an alias for __traits(foo, bar) ?

The code would look like this:

mixin(T::identifier ~ " " ~
       to!string(tolower(T::identifier[0])) ~
       T::identifier[1..$] ~ ";");

What do you think?

Another uses:

__traits(int, isArithmetic) ==> int::isArithmetic
__traits(C, isAbstractClass) ==> C::isAbstractClass

__traits(hasMember, S, "m") ==> S::hasMember("m")

Well, you get the idea...

:: might be applied to other compile time uses, but I just came up with this...

I agree it is a problem (a small one) but i don't believe it deserves a new syntax. Especially not a major one like this.
Like many others i think "meta" is a much better choice.

Reply via email to