Anonymous primitives?

Mark van Gulik ghoul6 at home.com
Thu Aug 23 19:36:22 UTC 2001


On Thursday, August 23, 2001, at 08:21 am, Stephen Pair wrote:
[...]
> Here is a small example that should illustrate how this kind of
> chicanery can mess up the caller's stack.  Install these on any object,
> then trying invoking exampleFailure.  You should get a
> MessageNotUnderstood error on #show:and: even though clearly your object
> implements that method.  This is because the stack was left unbalanced
> by calling the primitive with the incorrect number of arguments, and
> thus #show:and: is being sent to the wrong object (not self).  If you
> are aware of the issue, you can work around it, but I wouldn't build
> mission critical systems using this technique:
[snipped example]

Interesting.  In Avail, each of my primitives knows how many arguments 
to expect, and it is a *compilation error* if you attempt to compile a 
particular block/multi-method with the wrong number of arguments.  Note 
that in Avail there are no 'varargs' primitives because I have an 
explicit (comma-separated) list type that the compiler knows about.





More information about the Squeak-dev mailing list