Matrix, Array2D and SequenceableCollection
Brent Pinkney
brent_pinkney at yahoo.co.uk
Wed Dec 4 23:19:23 UTC 2002
Folks,
Short story:
------------
1. Array2D must go.
2. Matrix must be a SequenceableCollection
3. We need a new subclass of SequenceableCollection:
SubSequenceableCollection.
Long story:
-----------
I have been following the following the demise of
Array2D and the birth of Matrix with glee as I need a
decent table functionality.
A major problem with Array2D, as pointed dout on this
list, is that any matrix thing is not two dimensional
- only the subscript space is. Further, the name and
the interface stink. It should go away.
I have also been fiddling with Magma. It comes to pass
that Magma doesn't like to play with Matrix.
On further investigation, Magma was absolved of all
guilt - I can make my own Matrix class which works
perfectly.
But, the present implementation of Matrix is also
flawed in that a matrix IS sequential - after all row
major is an ordering. This is why is has to lie in
#isSequenceable.
However it is not implemented as a subclass of
SequenceableCollection becuase it would then inherit a
truck load of methods to do with copying sub-ranges:
e.g. #copyFrom:to: and friends.
It also has to reimplement a bucket load of methods to
pretend it is sequenceable.
IMHO the situation should be:
Object
Collection
SequenceableCollection
Matrix
SubSequenceableCollection NB!!!!!
ArrayedCollection
Array
OrderedCollection
...etc...
Then if the offending methods are moved down to
SubSequenceableCollection, all is well.
Regrettably, one cannot change the hierarchy of the
collection classes - too dangerous apparently. I
suspect something to do with the special objects
array.
If anyone knows how to do this, let me know and I will
test it.
I am awarding myself a beer in advance.
Cheers
Brent
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
More information about the Squeak-dev
mailing list
|