@property needed or not needed?

Dicebot m.strashun at gmail.com
Mon Jan 28 06:38:17 PST 2013


On Monday, 28 January 2013 at 14:28:30 UTC, Maxim Fomin wrote:
> On Monday, 28 January 2013 at 14:09:20 UTC, Dicebot wrote:
>> On Monday, 28 January 2013 at 14:00:16 UTC, Maxim Fomin wrote:
>>> Returning void instead of int in the example break assignment 
>>> chaining a = b = c. Besides, how such implicitly defined 
>>> functions may call user defined code (check input validity, 
>>> call events, etc.)?
>>
>> It should not if evaluating the value of (b = c) will call 
>> getter for b.
>
> Why getter and not setter? Expression a = b = c = d should call 
> getter for d and setter for rest of them. And if c setter 
> returns void the chain breaks.

"a = b" calls setter
"(a = b)" calls setter first, getter second
"x = b = c" is same as "x = (b = c)" thus calls setter, then 
getter and then setter again

I don't know how it is done know, but that is quite logical 
C-like approach based on the fact that result of expression (a = 
b) is equal to a.


More information about the Digitalmars-d mailing list