@property needed or not needed?

deadalnix deadalnix at gmail.com
Mon Nov 19 22:03:45 PST 2012


Le 19/11/2012 21:53, Andrei Alexandrescu a écrit :
> On 11/20/12 12:24 AM, deadalnix wrote:
>> Le 19/11/2012 06:58, Andrei Alexandrescu a écrit :
>>> On 11/19/12 4:01 AM, monarch_dodra wrote:
>>>> I kind of agree with Jonathan here. @property really shines when you
>>>> want to "add" an attribute to a struct.
>>>
>>> I kind of agree with him, too, but it would be a mistake to not reckon a
>>> change in dynamics. UFCS makes all those extra parens just awkward, and
>>> people will vote with their code regardless whether some particular
>>> viewpoint from some particular angle considers the approach backwards.
>>>
>>> Andrei
>>
>> As aid bunch of time, I'm pretty sure we can have a clean semantic and
>> still allow mosts use of parenthsesless call using opDispatch .
>
> Could you please give more detail? On first sight this seems to
> complicate the majority case for the benefit of a few.
>
> Andrei

consider the following opDispatch :

auto opDispatch(string name, T, U...)(T function() t, U args) {
     return mixin("t()." ~ name ~ "(args)");
}

I ommited to support delegates and to do the right checks in order to 
make the example obvious.

With such opDispatch, it is easy to get an autoevaluation for chained 
functions call via UFCS. () is only required on the last one.

I don't see how it can complicate the current situation. The current 
situation is like crazy complicated, and nobody is sure of what can be 
expected to be the correct behavior in many corner cases.


More information about the Digitalmars-d mailing list