DMD 0.177 release

Jarrett Billingsley kb3ctd2 at yahoo.com
Sat Dec 9 18:51:55 PST 2006


"Walter Bright" <newshound at digitalmars.com> wrote in message 
news:elfreq$1dvs$1 at digitaldaemon.com...
>
> Constructor:
>
> S(v);
>
> static opCall:
>
> S(v)
>
> What's the difference? I just don't see the point for adding constructors.

In addition to what Burton posted, class:

class C
{
    this()
    {

    }
}

Struct:

struct S
{
    static S opCall()
    {
        S s;
        return s;
    }
}

It's completely un-orthogonal.  Wouldn't it be so much cleaner and make so 
much more sense to allow ctors for structs?  Isn't this the _purpose_ of 
ctors, to initialize members to useful values?  Why have static opCall mean 
something completely different for structs and classes? 





More information about the Digitalmars-d-announce mailing list