@property

ArturG via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 8 15:54:31 PST 2016


On Thursday, 8 December 2016 at 22:46:32 UTC, Jonathan M Davis 
wrote:
> On Thursday, December 08, 2016 22:11:22 ArturG via 
> Digitalmars-d-learn wrote:
>> On Thursday, 8 December 2016 at 16:54:57 UTC, Adam D. Ruppe 
>> wrote:
>> > On Thursday, 8 December 2016 at 16:53:13 UTC, Satoshi wrote:
>> >> is there any advantage of marking function as @property??
>> >
>> > Not really. I think it just changes the meaning of
>> > typeof(thatfunc) but otherwise it does nothing.
>> >
>> > However, if you use it in a base class, you must also use it 
>> > when overriding the function.
>>
>> it does when you add it to for example a struct with alias 
>> opCall
>> this.
>> reported it as a bug
>> https://issues.dlang.org/show_bug.cgi?id=16951
>>
>> but seems to be addressed by https://wiki.dlang.org/DIP23
>
> ...
>
> - Jonathan M Davis

i actually didnt want to use @property at all, as i asumed that 
by using alias opCall this it would always call opCall not only 
sometimes.

the issue was about the commented line
// a; // Error: var has no effect in expression (a)

the rest can be solved by @property or a custom toString.


More information about the Digitalmars-d-learn mailing list