ufcs and integer params

Timon Gehr timon.gehr at gmx.ch
Sun Jul 15 15:33:11 PDT 2012


On 07/15/2012 11:56 PM, Jonathan M Davis wrote:
> On Sunday, July 15, 2012 23:47:58 Timon Gehr wrote:
>> On 07/15/2012 11:43 PM, Jonathan M Davis wrote:
>>> On Sunday, July 15, 2012 23:35:12 Timon Gehr wrote:
>>>>> The second level - i.e. strict property enforcement - also requires that
>>>>> non- property functions be called as functions.
>>>>
>>>> Exactly. This part is useless.
>>>
>>> And there, we will forever disagree.
>>
>> If it is a matter of personal preference, then it shouldn't be in the
>> compiler.
>
> It's a matter of enforcing the correct syntax,

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?



More information about the Digitalmars-d-learn mailing list