On 8/12/14, 6:31 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Aug 12, 2014 at 08:23:30PM +0000, Jonathan M Davis via 
Digitalmars-d-learn wrote:
On Tuesday, 12 August 2014 at 19:03:58 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
tl;dr: there are so many ways template code can go wrong, that I
don't it justifies blaming alias this for problems.

Allowing implicit conversions makes the problem much worse IMHO. It
makes it far too easy to write a template constraint which passes due
to the implicit conversion (even if an implicit conversion wasn't
explicitly checked for) but then have the function fail to work
properly because the implicit conversion never actually takes place
within the function (and if the template constraint doesn't explicitly
test for an implicit conversion, then the argument that the value
should have been explicitly converted doesn't hold). Fortunately, in
many cases, the result is a compilation error rather than weird
behavior, but in some cases, it will be weird behavior - especially
when the code involved is highly templatized and generic.
[...]

Y'know, after seeing the recent problem with deprecated functions in
template code...

Duck typing FTW

Reply via email to