Automatic Generation of Glue for Named Primitives
Bert Freudenberg
bert at isgnw.CS.Uni-Magdeburg.De
Tue Sep 14 11:07:26 UTC 1999
On Tue, 14 Sep 1999, Marcel Weiher wrote:
> > It may be true true that the inline-spec somewhat clutters a
> > method, but it has the advantage that all data is stored in only one
> > place. I'd find it rather distracting if I changed a primitive method
> > and then had to remember to go to another method to change the spec,
> > too.
>
> True enough for code that is only ever intended to go into
> primitives. What I am thinking about is code that normally executes
> as Smalltalk, but can optionally be made into a primitive.
> Therefore, the Smalltalk code needs to be uncluttered (or the
> compiler has to remove primitive-support message sends), otherwise
> there is a strange message send whenever the plain Smalltalk code is
> executed.
>
> I think it should be possible to accomodate both styles.
How about further extending the <primitive> declaration?
-------------------------------------
MyPlugin>>mySmallIntegerAdd: arg1 arg2: arg2
"Primitive. Add two integers. Optional."
< primitive: 'mySmallIntegerAdd' module: 'myModule'
returns: SmallInteger
arguments: (SmallInteger SmallInteger)>
^arg1 + arg2
-------------------------------------
This doesn't affect the Smalltalk code at all. If I think about it, that's
the place where the spec really belongs.
/bert
More information about the Squeak-dev
mailing list
|