DMD 0.177 release
Stewart Gordon
smjg_1998 at yahoo.com
Thu Dec 14 09:43:48 PST 2006
Walter Bright wrote:
> Stewart Gordon wrote:
<snip>
>> The programmer would have a choice - opAssign returning void to modify
>> in-place the object referenced by the lvalue, or returning a new
>> object that will be assigned to the lvalue. What is this precluding?
>
> opAssign has 3 externally visible characteristics:
>
> 1) the parameter
> 2) the 'this' pointer
> 3) the return value
>
> Your proposal mixes up 2 and 3. opAssign works like:
>
> a = b
> becomes:
> a.opAssign(b)
>
> The return value is not assigned to a, it is the value of the expression
> (a = b). Mixing up the return value and the assignment to a will cause
> problems, as the two are different things, and should be independent.
C'mon, what's your use case for being allowed to return something other
than the new value of a from the expression (a = b)?
Stewart.
More information about the Digitalmars-d-announce
mailing list