ufcs and integer params

Timon Gehr timon.gehr at gmx.ch
Sun Jul 15 10:50:18 PDT 2012


On 07/15/2012 05:40 AM, Jonathan M Davis wrote:
> On Sunday, July 15, 2012 05:30:55 Jay Norwood wrote:
>> I see from this other discussions that it looks like 2.059 ( or
>> maybe 2.060) does support something like 3.cm().   Not sure from
>> the discussion if it would also accept 3.cm as in the xtext/xtend
>> example.
>>
>> http://forum.dlang.org/thread/smoniukqfxerutqrjshf@forum.dlang.org
>
> UFCS (universal function call syntax) was added in 2.059. If cm is a function,
> then 3.cm() will work. If it's a property function, then 3.cm will work. If
> you don't compile with -property, then 3.cm will still work with cm being a
> non-property function, but -property will become the normal behavior
> eventually,  so you shouldn't expect that 3.cm will work long term unless cm is
> a property function.
>

I expect it to stay.

Another reason why @property-'enforcement' is flawed:

@property auto cm(int arg){ .. }

cm=2;   // ok
2.cm;   // ok

The two code snippets would in fact be equivalent.
What is enforced here? Why would it matter if anything is 'enforced'?


More information about the Digitalmars-d-learn mailing list