Copy constructors for lazy initialization

bearophile bearophileHUGS at lycos.com
Fri May 28 19:01:01 PDT 2010


Andrei Alexandrescu Wrote:

> this(ref S src);
> this(this);

> What do you think?

In this moment I am too much sleepy to understand the semantics of what you say.

But I can say something about syntax: that this(this) syntax is bad, it's cryptic, I prefer something that uses/contains some English word/name that I read and reminds me of what it does.

The this(ref S src) syntax makes things even worse in this regard. Please don't turn D into a puzzle language (note that I am not saying your feature is bad, far from it, I am just saying that the syntax you have proposed is very far from being easy to understand from the way it is written).

Regardless of what Don has said, here I'd probably like something like a readable @attribute to replace this(this) :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list