Implicit conversion to templatized type

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Nov 6 15:58:18 UTC 2020


On Fri, Nov 06, 2020 at 03:36:46PM +0000, Paul Backus via Digitalmars-d-learn wrote:
[...]
> User-defined implicit conversions are one of the most error-prone
> features of C++, and have been deliberately excluded from D, with the
> exception of `alias this`.

And Walter is already expressing regret at allowing `alias this`.  I
used to love `alias this`, and still use it in many of my projects, but
over time, I'm also starting to agree with Walter that it was a mistake.
Implicit conversions are generally not a good idea, except in very
narrow, well-defined cases. They are convenient, but lead to problems in
long-term maintenance.


T

-- 
People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird. -- D. Knuth


More information about the Digitalmars-d-learn mailing list