Another silly primitive question

Lex Spoon lex at
Tue Feb 16 18:04:23 UTC 1999

"Jim Benson" <jb at> wrote:
> Hi,
> My next silly primitive plug in question. How do I place a #include =
> statement into my plug-in primitive?
> E.g. I want to say "#include <foo.h>" into my plug in code stream. How
> do I do this?
> Jim

An alternative is to write the primitives in straight C, instead of
writing in Smalltalk and translating to C.  I see two basic kinds of
primitives, one of which this alternative seems good for.

First, there are primitives intended for speed increases.  For such
primitives, it makes perfect sense to write them in Smalltalk and then
use the translator--it's much easier to develop and test Smalltalk code
than it is to get into an edit-compile-restart cycle with C code.

On the other hand, there are primitives intended for low-level OS access
that Squeak doesn't understand.  For instance, adding pipes or Unix
domain sockets.  These kind of primitives tend to be pretty short, and
furthermore they aren't able to run under in Smalltalk.  For these, it's
probably *easier* to just write the C code directly.  The primitives are
unlikely to actually run in Smalltalk, anyway, so you have the same
edit-compile-restart cycle.

Does this 2-way classification strike people as reasonable?  If so, is
there a reason to use Smalltalk variants in the low-level-OS-calls class
of primitives?


PS -- the pluggable primitives rule for the low-level OS stuff!!  Now if
only I had a separate 24 hours each day for hacking on Squeak!

More information about the Squeak-dev mailing list