On Thursday, 12 July 2012 at 17:35:51 UTC, H. S. Teoh wrote:
On Thu, Jul 12, 2012 at 06:25:03PM +0200, David Piepgrass wrote:
I'm putting this in a separate thread from
http://forum.dlang.org/thread/uufohvapbyceuaylo...@forum.dlang.org
because my counterproposal brings up a new issue, which could
be
summarized as "Constructors Considered Harmful":
http://d.puremagic.com/issues/show_bug.cgi?id=8381
So, if I understand your proposal correctly, you're essentially
saying
that the ctor of a given class C may return a derived class of
C instead
of just C itself?
No, it can also return a different class with the same name.
Isn't this just the "object factory" pattern in disguise?
Is is a unification of syntax, just as UFCS is a unification of
syntax. It solves multiple problems, including information
hiding, and extending classes written by other parties.