bearophile wrote: > 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
Well, as long as S is the name of the struct, it's essentially what's done in C++ all the time. So, we get S(ref S src) instead of S(const S& src) The weird thing here is that you're actually altering the parameter that you passed in, which is normally a major no-no with copy constructors. - Jonathan M Davis