On Friday, 30 November 2012 at 03:27:57 UTC, Walter Bright wrote:
On 11/29/2012 11:10 PM, Jonathan M Davis wrote:
[...]

You're right, I had overlooked the point that having no default constructor means that the default construction will *always* succeed. This is a large simplification.

Frankly, non-trivial default construction has always smelled like a bad practice to me, though it's not always obvious why.

Just so we're clear, what we are asking for (or at least, what I'm asking for) isn't even *default* construction, but a way of calling a constructor that takes no arguments.

If:
"auto a = T(5);"
calls a constructor, then why can't:
"auto a = T();"
also call a constructor?

I'll repeat that I think that D's T.init semantics, and move abilities, are a great tool, but the cost of for we are paying for it is un-necessarily high, and unwarranted.

--------
The *only* reason I'd see against it, would be the initial confusion to C++ newcomers, but I mean: they already have to learn T.init and postblit anyways. They just have to learn it's a different language.

Related:
Why doesn't:
"auto a = int(5);"
work? and, even more importantly, why don't we have this? :
"int* p = new int (5);"
The fact that we have "T()/T(arg)", but not "int()/int(arg)" makes *zero* sense to me. THAT has been a source of initial confusion when I moved to D.

Reply via email to