DMD 0.177 release

Stewart Gordon smjg_1998 at yahoo.com
Mon Dec 11 09:07:42 PST 2006


Walter Bright wrote:
> Chris Miller wrote:
>> On Sat, 09 Dec 2006 13:59:24 -0500, Walter Bright 
>> <newshound at digitalmars.com> wrote:
>> 
>>> Chris Miller wrote:
>>>> Allow static opAssign to return an instance of the class that will 
>>>> be assigned to the lvalue:
>>> 
>>> This wasn't done because there are several use cases where you 
>>> wouldn't want to erase all previous contents of the struct being 
>>> assigned to.
>> 
>> But if it's optional it's up to the struct writer to use void as the 
>> return or not.
> 
> I don't think that'll work. He'll wind up being forced to set all the 
> fields.

Doesn't follow - there might not be any to set other than those that are
an inherent part of the assignment operation.

For example, consider an immutable big integer class.  One might want

     Int x;
     ...
     x = 42;

as syntactic sugar for

     x = new Int(42);

Stewart.



More information about the Digitalmars-d-announce mailing list