Automatic Generation of Glue for Named Primitives

Andrew C. Greenberg werdna at gate.net
Wed Sep 15 02:08:32 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.

This has been suggested, but was not well-received by TPTB.





More information about the Squeak-dev mailing list