On 28-04-2011 16:39, Moritz Warning wrote:
On Thu, 28 Apr 2011 08:02:40 -0400, bearophile wrote:

A little quiz. This is related to a recent post of mine in the main D
newsgroup, but please don't take a look at that post yet. This is the
original function:
uhm, very sneaky.
I wonder, can there be done smth. on behalf of the language to prevent
this kind of bug?
There sure is: disallow implicit conversion of types. That's how languages like Haskell work. It can be annoying having the compiler complain because you're using and 'int' where it expected a 'double' for example, but on the other hand it avoids many hard to detected bugs (like this one).

Pedro Rodrigues

Reply via email to