[BUG] Interval Copy
Andrew P. Black
black at cse.ogi.edu
Thu Mar 2 02:05:25 UTC 2000
At 16:59 -0500 2000.3.1, agree at carltonfields.com wrote:
>This is, of course, an example discussed during the
>"superDuperSuper" discussion in another thread.
Before my time on the list.
> I think we uniformly concluded that recourse to superSuper, whether
>directly or by indirect means indicates that something deeper is
>broken, requiring more careful refactoring.
I agree wholeheartedly.
>Thus, I conclude that the ugliness is probably more than skin-deep
>here, and requires deeper thinking. Recall that the redefinition of
>"species" (defined as the preferred class for reconstruction)
>implies that messing with shallowCopy might yield some undesireable
>results.
Species is another example of ugliness peeking through. LaLonde &
Pugh ("Inside Smalltalk") discuss a refactoring of the collection
classes that does away with species in favour of uniform use of
newEmpty.
>In the meanwhile, and presuming that modifying shallowCopy would not
>break things, perhaps the following will do:
>
> shallowCopy
> ^ self class from: start to: stop by: step
Yes, I think that will do very nicely. Thank you. Quite elegant.
Another symptom of the rot here, or maybe of some previous
refactorings not completely carried through, is that Interval class
redefines new! The code is essentially a copy of the code in
Behavior. The comment says
Override SequenceableCollection new. Essential. See Object
documentation whatIsAPrimitive."
But this is again wrong. SequenceableCollection does not (any more?)
define new as a class method, and this version is far from essential
-- things seem to work very nicely without it.
Andrew
More information about the Squeak-dev
mailing list
|