__traits so long and ugly, what about ::?

Ary Manzana ary at esperanto.org.ar
Wed Mar 30 15:32:20 PDT 2011


On 3/30/11 5:52 PM, KennyTM~ wrote:
> 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.

Look, metaprogramming in Ruby is a relatively advanced part of the 
language. And you know why it is heavily used and everyone can jump and 
start using it in a matter of seconds and build the most amazing things? 
Because it's very, very, very, (add 1000 very words here), very easy to use.

Why make *anything* hard to use if you can do it in an easier way?


More information about the Digitalmars-d mailing list