DMD 0.177 release

Walter Bright newshound at digitalmars.com
Wed Dec 13 16:48:01 PST 2006


BCS wrote:
> With constructors, it is not only simpler code, but looks like what is 
> happening.
> 
> struct S
> {
>     static S err;
>     int k, l;
> 
>     this(int i, int j)
>     {
>         k=i;
>         l=j;
> 
>         if(!ret.test) this = err;
>     }
> 
>     bool test(){...}
> }

Assignment to this inside a constructor is a mistake as it breaks the 
assumptions the language makes about constructors.



More information about the Digitalmars-d-announce mailing list