ufcs and integer params

Jacob Carlborg doob at me.com
Sun Jul 15 23:41:20 PDT 2012


On 2012-07-16 00:33, Timon Gehr wrote:

> This post seems to attempt to distract from the fact that the topic of
> the discussion is which syntax is correct.
>
>> which the compiler does all the
>> time. It's just that you don't think that the compiler should care in
>> this
>> particular case, since it hasn't cared in the past.
>>
>
> The compiler does not and has never 'not cared'. It has to do slightly
> more work. This is a designed language feature, although it's a trivial
> one. eg. Eiffel and Scala have the same thing.
>
> The prime reason why I think it is beneficial if no more restrictions
> than necessary are applied is UFCS:
>
> array(map!(x=>2*x)(range));   // should be fine
>
> range.map!(x=>2*x).array;     // so should this
>
> range.map!(x=>2*x)().array(); // who needs this?

Exactly.

-- 
/Jacob Carlborg




More information about the Digitalmars-d-learn mailing list