@property needed or not needed?
Dicebot
m.strashun at gmail.com
Mon Jan 28 09:41:06 PST 2013
On Monday, 28 January 2013 at 17:20:13 UTC, Maxim Fomin wrote:
> ...
Those are C rules, do not forget it. Thus value of (b = c) IS
equivalent to value of b when lvalues are considered. And you are
perfectly allowed to forget about c and do a = b after b = c was
evaluated. It is plain old data, after all, if b = c is not
interchangeable with b, something is wrong.
At least I see nothing in standard that proves your statement.
>
> Applying your logic:
>
> Left operand for a = (b = c) is a. Thus a has value of (b = c).
> Value of b = c is b.setter(c.getter()).
You are applying it wrong. Thing of it as of recursion.
1) evaluate "a = b = c"
2) evaluate a.set( (b = c).get() ), result of 1 will be a.get() (
if needed )
3) evaluate "b = c"
4) evaluate b.set( c.get() ), result of 3 will be b.get() ( if
needed )
5) combine: a.set( b.set( c.get() ), b.get() )
Note that evaluation order for comma expression is defined, so
"c.get() ), b.get()" is valid and correct code.
More information about the Digitalmars-d
mailing list