|
![](/i/fill.gif) |
Darren New wrote:
> If you declare a function taking a float and an unsigned int parameter
> in C#, you can't just call it as
> xyz(0.3, 12)
>
> You have to actually say
> xyz(0.3f, 12u)
> because doubles don't silently cast to floats and ints don't silently
> cast to unsigned ints. Even tho these are literals the compiler can see
> cast without losing precision. Feh.
Isn't this the case with Java too?
Now of course, in Haskell, "3" can represent any numeric type. That
includes complex numbers, for example. So if you write "print 3", the
compiler moans at you because it's not sure which of the possible
numeric types you meant. (Should it print out as "3" or "3.0" or "3 :+:
0" or "3.0 :+: 0.0" or "3/1" or...)
"3.0", on the other hand, has to be one of the fractional types. But
that's still a fairly long list.
Post a reply to this message
|
![](/i/fill.gif) |