[FIX] Re: Apology

Andrew P. Black black at cse.ogi.edu
Tue Nov 14 08:39:55 UTC 2000


--- In squeak at egroups.com, "Richard A. O'Keefe" <ok at a...> wrote:
>
>        >I *did* find a bug while poking around (try inspecting
>        >Week fromDate: (Date today), select self, and then choose ... Explore;
>        >you'll get a MessageNotUnderstood

The core of Richard's problem is that equality does not work for 
dates.    For example, try to printIt on

     Date today = nil

You get a walkback.  The problem is that the method for = answers

     ^ julianDayNumber = argument asJulianDayNumber

and, of course, nil does not understand asJulianDayNumber.

Explorers do this comparison (of the target with nil) when looking 
for a selector to highlight, hence the symptom that Richard described.

It seems to me that Explorers should not assume that all objects can 
respond to =, since you are likely to use an Explorer while debugging 
an object into existence.   Does anyone volunteer to look more 
closely at what Explorers are doing?

Nevertheless, Dates should have a less fragile = method.

I don't like testing the class of an object explicitly, so my fix is 
as follows.

'From Squeak2.8 of 13 June 2000 [latest update: #2359] on 13 November 
2000 at 6:42:28 pm'!

!Date methodsFor: 'comparing' stamp: 'apb 11/13/2000 18:40'!
= aDate
         "Answer whether aDate is the same day as the receiver."
         (aDate respondsTo: #asJulianDayNumber)
                 ifFalse: [^ false].
         ^ julianDayNumber = aDate asJulianDayNumber! !)





More information about the Squeak-dev mailing list