Counterproposal for extending static members and constructors

deadalnix deadalnix at gmail.com
Thu Jul 12 11:36:15 PDT 2012


On 12/07/2012 19:37, 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/uufohvapbyceuaylostl@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?
>
> Isn't this just the "object factory" pattern in disguise?
>

It is, and in D we don't need object factory, we just need a free function.


More information about the Digitalmars-d mailing list