Plug in primitive help

Jim Benson jb at speed.net
Thu Feb 11 18:42:02 UTC 1999


Thanks Tim.

Does this really mean that I need to return something? I assume that in the
simplest case, basically a no-op, I need to return the receiver on the
stack, making the example incorrect.

Put another way: Let's say that I am writing a primitive that I do not have
to return a value. You're saying in this case I have to return the receiver,
in other words, always returns self?

Jim

-----Original Message-----
From: Tim Rowledge <rowledge at interval.com>
To: Squeak <squeak at cs.uiuc.edu>
Date: Thursday, February 11, 1999 10:22 AM
Subject: Re: Plug in primitive help


>The basic rule is to
>a) if the primitive suceeds, pop all the arguments and the reciever, then
push
>the answer you want to return. Of course, if you intend to return the
reciever,
>save time by not popping it !
>b) if the primitive fails, do not pop anything, call primitiveFail() and
return.
>You have to take care to balance these things properly or as you have
>discovered, life can get unpleasant.  If you write your prims in a style
where
>you pop arguments as you go along, you will need to be particularly careful
to
>unpop the correct number if you fail part way through.
>
>tim
>
>--
>Strange OpCodes: ESR: Emulate Slide Rule
>Tim Rowledge:  rowledge at interval.com (w)  +1 (650) 842-6110 (w)
> tim at sumeru.stanford.edu (h)  <http://sumeru.stanford.edu/tim>
>
>





More information about the Squeak-dev mailing list