On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
Interestingly enough, I realized that atan() returns double (in this case) but wait, it's assigned to a float variable! Compiler didn't even emit warnings, let alone errors.


There a few lessons here.

(1) D is not Java ;-)
(2) Know what types are being returned from your calls, before you call them. (3) Know what the language spec says about conversions (and their order):
    - https://dlang.org/spec/type.html
(4) If unsure, test it:
- https://dlang.org/phobos/std_traits.html#isImplicitlyConvertible

Only then should you start coding ;-)

oh...and...

(5) Don't waste time arguing with the spec ;-)
(6) Don't expect the compiler to not comply with the spec

Reply via email to