PROPOSAL: Implicit conversions of integer literals to floating point
Manfred_Nowak
svv1999 at hotmail.com
Thu Dec 30 17:22:27 PST 2010
Don wrote:
> disallow conversions integer->floating point
In version 0.80 floating point->integer was disallowed. The reasons that
triggered that disallowance in 0.80 are symmetric.
A reason was:
`(4,2)' might be mistyped as `(4.2)'
and symmetric means:
`(4.2)' might be mistyped as `(4,2)'
Such typing errors are close to undetactability and known to have caused
tremendous hazard. In D they can be accompanied by the usage of appropriate
overloads or variadic templates.
Therefore disallowing implicit conversions integer->floating point is the
right way to go.
Otherwise I will feel no sorry for those who get an output of "21.414" when
they expected "2.049".
-manfred
More information about the Digitalmars-d
mailing list