__traits so long and ugly, what about ::?

KennyTM~ kennytm at gmail.com
Wed Mar 30 13:52:46 PDT 2011


On Mar 31, 11 04:19, Alix Pexton wrote:
> On 30/03/2011 20:45, KennyTM~ wrote:
>> This is confusing as :: is used to separate scopes in C++ (and PHP too).
>
> The first thing it reminded me of was Lua, where a single colon makes
> the left hand side into the first argument of the function on the right.
>
> foo:bar(x) ==> bar.(foo, x)
>
> So it felt kinda familiar to me ^^
>
> A...

That is almost like UFCS in D.

     int foo(string x, int y) { return x.length - y; }

     assert (foo("testing", 3) == 4);
     assert ("testing".foo(3) == 4);

But OP's proposal is restricted to __traits only.

__traits is a relatively advanced part of the language, plus many of its 
features has already been exposed via the library std.traits, e.g. 
std.traits.hasMember!(S, "m"), I don't think it really needs a very 
short syntax.



More information about the Digitalmars-d mailing list