"Constructor" was a Very Bad name choice we have never recovered from (Was Re: D is dead)

Guillaume Piolat spam at smam.org
Mon Aug 27 11:02:14 UTC 2018


On Monday, 27 August 2018 at 03:06:17 UTC, John Carter wrote:
>
> The last few years I have told myself (and anyone who doesn't 
> back away fast enough) that "Constructors" do _not_ construct 
> objects, they are "Name Binders." (Sort of like lisp's "let" 
> macro)
>
> They bind instance variable names to pre-existing sub-objects.

One could say there is "storage" and "instantiation" of an object.
C++ binds the two in the same operation.

D does not, T.init must be a valid object. This is a major 
cultural change, though I believe the D way is superior on the 
efficiency stand-point (you can create large arrays of valid 
objects quite fast).


More information about the Digitalmars-d mailing list