I accidently sent this just to Darren ...


---------- Forwarded message ----------
From: Jonathan Scott Duff <[EMAIL PROTECTED]>
Date: Jan 22, 2007 6:23 PM
Subject: Re: Numeric Semantics
To: Darren Duncan <[EMAIL PROTECTED]>

On 1/22/07, Darren Duncan <[EMAIL PROTECTED]> wrote:.

I think that 1 should be an Int and 1.0 should be a Num.  That makes
things very predictable for users, as well as easy to parse ... the
visible radix point indicates that you are usually measuring to
fractions of an integer, even if you aren't in that exact case.  Also
importantly, it makes it easy for users to choose what they want.

For round-trip consistency, a generic non-formatted
num-to-char-string operation should include a .0 as appropriate if it
is converting from a Num, whereas when converting from an Int it
would not.

Furthermore, my preference is for Int and Num to be completely
disjoint types, meaning that "1 === 1.0" will return False.  However,
every Int value can be mapped to a Num value, and so "1 == 1.0" will
return True as expected, because == casts both sides as Num.

While I'm in general agreement with everything you've said it makes me a
tad  nervous to hinge so much on the difference of one character.  Can you
imagine trying to track down the bug where

   if ($alpha === $beta) { ... }

really should have been

   if ($alpha == $beta) { ... }

Anyway, it's not like this problem wasn't already there, it's just that your
email made it stand out to me.


Jonathan Scott Duff

Reply via email to