Redux Re: Questions On Proposed ANSI Standard DateAndTime
james at foster.net
Thu Jul 9 12:55:15 UTC 1998
From: R. A. Harmon <harmonra at webname.com> (with possible editing)
>>Is the following result of the Duration [SIC]>>#asLocal message correct?
>Is "[SIC]" used to indicate containing some error? If so, what? It just
>piqued my interest.
Yes. Your question should have asked about the DateAndTime>>#asLocal
message. Duration>>#asLocal does not exist.
>>>Should the Duration>>#< message given an operand other than an instance
>>>class Duration generate an error or return false?
>>Asking a duration of ten minutes if it is less than the color orange does
>>not seem to be false unless you can come up with a way to make 10 minutes
>>greater than orange. I would expect an error.
>I'm not sure what you mean. The color orange is always less that any other
>object in Smalltalk. See page 107 of "Smalltalk-80: The Language and its
>I even amaze myself sometimes.
Unfortunately, I don't have a copy of Smalltalk-80, so you have me there!
I will note, however, that section 188.8.131.52 of revision 1.9 of the proposed
ANSI standard states that the Duration>>#< message "is erroneous if the
receiver and operand are not comparable." I'm not sure if comparable is
defined elsewhere, but the standard does seem to anticipate some operands
that would cause an error.
While I will not make an argument for type checking in the compiler, I will
say that if my code were comparing a Duration with a Color, it would be an
error and I would prefer that the error be identified as close to the
problem as possible. If the error were not caught here, then there would
probably be some logic problem that would manifest itself later and would be
harder to find.
I'll look forward to seeing your contribution.
More information about the Squeak-dev