tim at rowledge.org
Thu Aug 11 04:32:03 UTC 2005
> >> 2. Doesn't Smalltalk have primitive strings, ints, bools, etc?
> > Yes and no. Squeak has primitives for objects requiring heavy
> > computation, or more exactly, plugins called by methods wanting a
> > more punch from the processor. The plugins can be internal or
> > to the VM.
> That's what I thought. I knew the "can't use pure objects" thing was
> malarkey. I remember getting acceptable (but not great) results from
> VisualAge Smalltalk back in '94.
Hang on, it seems that someone might be getting confused here. We need
to differentiate between primitive types (like java has) and primitives-
as-in-code that Smalltalk has.
Primitive types that are exposed to the programmer are not a good
thing. Making there be two utterly separate ways of dealing with
integer values, one as a variety of Object and the other as mere bits
is, in my extremely strong opinion, bloody stupid. I've always
maintained that if one is going to do objects (or any other paradigm)
you should do it properly. Mixed styles (object FORTRAN, ghu help us)
are an almost solid guarantee of disaster. An object system that allows
pointers into memory locations is so stupid that...well I can't think
of anything adequate to the comparison.
I'll also point out that Smalltalk primitive routines are mostly useful
for work where there is no real benefit in doing it in Smalltalk (you
could implement addition via message sends to extract bits, shift and
merge but why do something the complicated way when an easy way is
sensible) or where something simple and repetitive (scanning a string
for a character) has to be done. There are also cases where a primitive
is useful for engaging control of the virtual system (process
management) or making an operation effectively atomic (signalling a
sempahore). We also find primitives a convenient way of accessing much
platform specific behaviour since it makes for a pretty solid
encapsulation and abstraction. Note that we could build all the
functionality of plugin primitives such as the FilePlugin set from
Smalltalk code and an FFI analogue. I know this for certain since the
old BrouHaHa/Archimedes/ActiveBook systems did exactly that and
reliedupon good Smalltalk coding to encapsulate the functionality
Tim Rowledge, tim at rowledge.org, http://www.rowledge.org/tim
Strange OpCodes: LTT: Lose Timing Track
More information about the Squeak-dev