On Wednesday, 17 April 2019 at 15:23:06 UTC, Stefanos Baziotis wrote:
Sorry if this has been asked again, I didn't find anything.
Do we know the reason why it is not supported?

Basically implicit construction was considered a mistake in C++ and D didn't want to repeat that mistake. Most code guides for C++ say to always (or almost always) mark your constructors with `explicit`, so D just makes that the only option.

I argue C++'s mistake was *out-out* implicit construction, not the concept in general - I kinda wish D would allow it if you specifically asked for it in the type.

Walter also says though implicit construction complicates function overloading rules and compiler error messages, and he doesn't think it is worth the cost to even try it with a new keyword (IIRC, I haven't had this chat with him for a while, so I might be misremembering). Again, his experience with it in C++ on several levels was negative and he wanted to simplify D so people are more likely to do the right thing.

I actually agree with him 90% of the time... just I wish it was available there for the other cases still.

Reply via email to