DMD 0.177 release

Walter Bright newshound at digitalmars.com
Thu Dec 14 13:05:05 PST 2006


Lionello Lunesu wrote:
> Walter Bright wrote:
>> It is possible to force the return type of opAssign. But I'd suggest 
>> making it an S*, with the rewrite to:
>>
>>     *(a.opAssign(b))
>>
> 
> class C {
>   C* opAssign(...) {...}
> }
> struct S {
>   S* opAssign(...) {...}
> }
> 
> Seriously?? Ugh.

It isn't necessary for classes, as they are already reference types.

> Why not just "C opAssign" and "S opAssign"? In the opCall discussion you 
> said yourself that the return value will be optimized.
> 
> Am I missing something?

Yes. The issue is that opAssign has both a return value *and* copies 
values into it's 'this' pointer.



More information about the Digitalmars-d-announce mailing list