[Cuis-dev] [DEFECT] #copyFrom:count: for OrderedCollections

Juan Vuletich juan at cuis.st
Tue Feb 6 08:21:45 PST 2024


Let me also elaborate a bit on the rationale.

In Smalltalk-80 (and every other Smalltalk system since then), the docs 
will say that #new: will answer a collection of the requested size. But 
it is not like that for Set, Dictionary, OrderedCollection and a few 
others, that give a completely different semantics to this message. It 
is no _that_ bad when the message is sent to an explicit class, although 
you need to be aware of this.

The real problem is when someone does `someCollection species new: 
aNumber`. It gets really tricky to find out what is going to happen.

This is a prime example of what I call "False Polymorphism". It looks 
like a polymorphic message, but it is not. It is (at least) two sets of 
senders/implementors, completely separated. This means obscure, 
misleading code. It makes me sick. I fix every instance of this I see. 
It rarely happens in the base Smalltalk-80 classes, but it is still wrong.

Thanks,

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich



More information about the Cuis-dev mailing list