DIP 52 - Implicit conversions
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Wed Dec 11 13:00:12 PST 2013
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.
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.
More information about the Digitalmars-d
mailing list