Add support implicit conversion between types

monarch_dodra monarchdodra at gmail.com
Fri Sep 6 10:56:52 PDT 2013


On Friday, 6 September 2013 at 17:49:04 UTC, Jonathan M Davis 
wrote:
> Personally, I think that this is opening a whole can of worms 
> that should
> never be opened. alias this already causes enough trouble for 
> stuff like
> templates (primarily because it becomes far too easy to pass a 
> template
> constraint and yet fail to work in the actual code). It's 
> ultimately way
> cleaner and far less bug-prone to disallow this sort of 
> implicit conversion,
> especially when so much D code is generic code.
>
> - Jonathan M Davis

The problem with "alias this" is that it was designed to emulate 
inheritance, but was *diverted*, specifically, to emulate 
"implicit casting instead".

I think the results speak for themselves how well that worked...

As a matter of fact, there are more than a few classes where I 
wish we could deprecate the static alias, and re-force explicit 
cast.


More information about the Digitalmars-d mailing list