DMD 0.177 release

Walter Bright newshound at digitalmars.com
Sat Dec 9 18:53:36 PST 2006


Burton Radons wrote:
> Here's the difference:
> 
>     struct S
>     {
>         this (int x)
>         {
>             w = calculate_something (x);
>         }
> 
>         this (int x, int y)
>         {
>             this (x);
>             z = calculate (y);
>         }
>     }

struct S
{
     static S opCall(int x)
     {
	S result;
	result.w = calculate_something(x);
	return result;
     }

     static S opCall(int x, int y)
     {
	auto result = S(x);
	result.z = calculate(y);
	return result;
     }
}

It's 3 more lines of code. The two styles almost completely overlap, and 
since the latter is already in use, adding ctors just seems redundant.



More information about the Digitalmars-d-announce mailing list