DMD 0.177 release

Boris Kolar boris.kolar at globera.com
Sun Dec 10 01:26:00 PST 2006


== Quote from Walter Bright (newshound at digitalmars.com)'s article
> Jarrett Billingsley wrote:
> >> It turns out that static opCall() and this() are equivalent. C++ has some
> >> obscure rules to try to disambiguate them. I wished to avoid that problem,
> >> and since static opCall() is routinely in use, picked them.
> > For classes they're not.  Why should structs be any different?  And even if
> > static opCalls are routinely in use, are they the best solution?
> I've found they work well.

Yes, but ctors would work even better:

  this(int a, int b) {
    _a = a;
    _b = b;
  }
  static Foo opCall(int a, int b) {
    Foo foo;
    foo._a = a;
    foo._b = b;
    return foo;
  }

Suggestion: disallow both opCall and ctor for the same struct and
there should be no ambiguity issues.

> That's implicit casting from a struct. It'll probably wind up getting
> supported in one form or another.

That's great :)

It seems that some D issues suffer from "Black hole theory of languages":
"C++ is a Black Hole: if you try to design something that's not C++, but like C++,
you'll find that the gravitational forces on the design will suck it into the
Black Hole, and it will become C++"



More information about the Digitalmars-d-announce mailing list