* bogus codegen with static opAssign() usage *

Gregor Richards Richards at codu.org
Mon Feb 19 00:30:27 PST 2007


Walter Bright wrote:
>     a = b;
> 
> is replaced with:
> 
>     a.opAssign(b);
> 
> not:
> 
>     a = a.opAssign(b);
> 
> The return value of opAssign comes in to play with:
> 
>     c = a = b;
> 
> which is rewritten as:
> 
>     c = a.opAssign(b);

This makes quite a bit of sense, actually. It's consistent.

But it begs the question: Is there a way to do what is desired here? 
That is:

SomeClass a = "Instance generated by a string";

  - Gregor Richards



More information about the Digitalmars-d mailing list