why are Assign Expressions r-values?
BCS
ao at pathlink.com
Fri Apr 27 16:52:46 PDT 2007
Why is this not allowed
foo(inout int a);
int a;
foo(a=1);
The reason the compiler objects seems to be that the "semantic value" of
an assign expression is the value that was assigned. However if the "semantic
value" were the LHS (the variable assigned to) then in most cases the effect
would be exactly the same, however the expression could be used as an l-value.
Mostly this would be useful with functions that take inout args but some
other uses might exist.
More information about the Digitalmars-d-learn
mailing list