On 2013-12-11 22:00, Joseph Rushton Wakeling wrote:
On 11/12/13 13:44, Simen Kjærås wrote:
I've tried to figure out good ways to add some sorely-needed implicit
conversions to the language, but I'm sure there are details that need
to be
ironed out. In other words - destroy!

Since you brought up std.complex: some of the issues here are subtle.
For example, it's appropriate to allow implicit conversion from
numerical => Complex (although this can be done fairly readily by just
calling complex(x) where x is a numerical type); it's also appropriate
to allow implicit conversion from Imaginary => Complex; but it'd be
wrong to allow implicit conversion from numerical => Imaginary.

To be honest, I don't find that subtle - it's basic dimensional analysis. :p


Conversely, I'm not certain whether it'd be appropriate to allow
implicit conversion Complex => numerical or Complex => Imaginary, even
if the imaginary or real parts respectively were zero.

I'm certain it would not. At least in my mind, that's almost as bad as allowing implicit conversion from string to integer, based on the confused notion that it *might* be valid.

--
  Simen

Reply via email to