Counterproposal for extending static members and constructors

Jonathan M Davis jmdavisProg at gmx.com
Thu Jul 12 12:27:06 PDT 2012


On Thursday, July 12, 2012 18:25:03 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

I think that adding constructors to a type from an external source is 
downright evil. It breaks encapsulation. I should be able to constrain exactly 
how you construct my type. If you want to create a free function (e.g. a 
factory function) which uses my constructors, fine. But I'm completely against 
adding constructors externally.

- Jonathan M Davis


More information about the Digitalmars-d mailing list