Implicit conversions through purity
bearophile
bearophileHUGS at lycos.com
Sat Apr 12 18:52:13 PDT 2014
Jonathan M Davis:
> Honestly, I would have considered that to be a bug. Converting
> the return type
> to a different level of mutability based on purity is one
> thing. Automatically
> casting the return value just because the function is pure is
> another matter
> entirely. Clearly, it can work, but it seems incredibly sloppy
> to me.
In foo1 D is working as designed, as this was a desired feature,
it has passed the Kenji and Walter review, and it was implemented
several months ago. It's a very handy way to create immutable
data with pure functions and it's safe, it's safer than
assumeUnique that is just a convention. Very recently Walter has
further improved this feature, allowing more implicit conversion
cases. So it's the opposite of a bug, it saves you from bugs in
three different ways.
But my question was about the successive foo functions :-)
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list