ExternalByteArray and structures

Edward P Luwish eluwish at uswest.com
Thu May 20 16:52:28 UTC 1999


This would be a particularly useful adjunct to something like QKS'
SmalltalkAgents "structure" construct which I don't think has an equivalent
in Squeak.  This construct is an optional component of any class,
and consists of a fixed amount of raw storage attached to each object of
that class.  The internal structure of this raw storage is described by a
subclass of Structure, which is similar to a C struct in nature.  When the
structure is externalized (through a mechanism such as yours), its internal
components can be accessed via a C struct or equivalent.  Since the
structure is also a first class Smalltalk object, its internal components
are accessible (or not) by other objects (including the object the
structure is attached to) by the usual mechanisms.  Additional classes
corresponding to C types are defined for the building of C-compatible
structured entities and their Smalltalk protocols.  Endian-ness would be
handled by the externalization methods of these classes.
ExternalByteArray would have import and export methods to exchange these
structures with an addressable segment of external memory, in addition to
the methods for doing the same with any object that can be coerced into a
ByteArray.

I am not sure whether this concept fits in with the [much] earlier
discussion about calling out of or into Smalltalk, or how it compares with
pluggable entities, since I am new to Squeak, but it would be an excellent
way of "grafting" functionality into Squeak before completing its native
implementation.  I also do not know how much surgery would have to be
performed on ObjectMemory in order to accomplish it.  It just looks like
a good idea we can borrow if it hasn't been patented.

Ed





More information about the Squeak-dev mailing list