[self-interest] Re: Self Syntax Question

Jecel Assumpcao Jr jecel at lsi.usp.br
Tue Oct 5 23:51:52 UTC 1999


Stefan Matthias Aust wrote:
> My question is, does this work only for unary message selectors or also for
> binary and keyword selectors?  Or in other words, are these legal expressions?
> 
> (|
> = whatever = false.
> ifTrue: aBlock = nil.
>  |)

Looking at the grammar definition for Self in the "Programmer's
Reference Manual" it would seem that you should be able to place
a "regular object" in there. That would be a literal object,
optionally with code (which excludes things like false and nil).

(| = x = false |) gives you a "Syntax Error: object expected"
as the manual implied. Trying (| = x = (| a = 3 |) |) should
have worked, but instead yielded "Syntax Error: empty objects
cannot have arguments", which is a pretty obscure message for
this error. Looking at the C++ code for the VM we can see that
only method objects are allowed here, so it would be better if
the message said so.

> My current SELF implementation requires a method object here, but
> especially for blocks etc., constant keyword slots would be handy, I think.

I agree it would be interesting. When I wrote tinySelf 0, the grammar
that I derived from the Self docs insisted on a method (I think it
was based on Self 2.0) for binary and keyword slots and I had never
thought about this.

--  Jecel



More information about the Self-interest mailing list