[squeak-dev] Input on class design for someone new to squeak
Danny Chan
chan_dhf at yahoo.de
Fri Apr 18 20:39:27 UTC 2008
Hi!
Lately I have been playing with approaches to implement multi dimensional
arrays in squeak with functionality similar to python's numpy library. The
structure I've come up with has a main array class with instance variables
pointing to a ByteArray and an array type object. Whenever a message is sent
to an array object, it is dispatched to the array type object which in turn
will then choose a concrete implementation from a plugin. The code in the
plugin is automatically generated from definitions contained in the various
array type classes. For an accessor like at: for example I have a concrete
implementation as Slang plugin for each data type that casts the ByteArray
data to a pointer of the required type. So I have a structure looking like
this:
class ivars
SqArray buffer, arrayType
SqArrayType
- SqArrayInt8
- SqArrayInt16
- SqArrayFloat32
.....
SqArrayPlugin -> concrete implementations
Is this a sensible design for doing something like this in Smalltalk? Am I
abusing the Squeak plugin mechanism very badly? And finally, does something
better already exist?
Any input and constructive criticism is very much appreciated,
Danny
More information about the Squeak-dev
mailing list
|