[BUG][FIX] OrderedCollection>>#do:

Dean_Swan at Mitel.COM Dean_Swan at Mitel.COM
Thu Apr 13 17:25:24 UTC 2000



From:  Dean Swan at MITEL on 04/13/2000 01:25 PM

"Dan Ingalls" <dan.ingalls at disney.com> wrote...
>"R. A. Harmon" <harmonra at webname.com> wrote...
>>Evaluating:
>>
>>   ContextPart trace: [OrderedCollection new]
>>
>>cause a MNU error because index (= firstIndex = nil) <= lastIndex (= nil).
>>
>>My proposed fix is the following:
>
>    <Nil-tolerant code for OrderedCollection do:>
>
>I'm wondering if it wouldn't be better to wrap an exception
>around trace:'s attempt to print.  Otherwise we might find
>ourselves sprinkling lots of code around that wastes time just
>because of wanting to print things that are in an inconsistent
>state.
>
>Or, if we decide that every object should be able to respond to
>printOn:, even when in an inconsistent state, perhaps the fixes
>should be put in printOn:.  That way, at least we don't clutter
>the kernel do: logic that probably runs a billion times for every
>one attempt to print an OC before it has been initialized.
>
>I think I'm still partial to using an exception here, but what
>does everyone else think?  I definitely agree with Richard that it
>shouldn't just barf.

Dan,
     I agree that adding code for *very* unusual cases to the 'do:' logic is not
the way to go. I personally have an expection that every object can respond to
'printOn:' in a reasonable fashion, at all times, WITHOUT generating an
exception, or a walkback.  So, I would prefer seeing the fixes in 'printOn:'.
Just my $0.02....

                                   -Dean Swan
                                   dean_swan at mitel.com









More information about the Squeak-dev mailing list