parsing [foo]: selectors versus variables

Brian T Rice water at tunes.org
Sun Jun 1 11:29:03 PDT 2003


On Sun, 1 Jun 2003, Paul Dufresne wrote:

> Suppose you parse [foo]. Should foo seen as a selector send to the
> current context, or a variable. I guess the answer depends on the fact
> that a variable named foo exist.

If you mean a part of a block header, then I should point out that this is
why we require block headers to open with "|"; it disambiguates situations
like these. Suffice it to say that you can't open a block by sending the
context a "|" message. :)

So foo is a message-send. That's what it normally is. A variable-access is
only hardcoded if the parser or IR builder can determine this fact from
the source (which is very common, really).

> If a variable foo exist, to what kind of Node should it parse to?

It's always a unary message-send. It gets compiled to a local variable
access when the compiler can figure this out (which again should be
common).

> I wonder if a different syntax should not be used for variables, at
> least, for bootstrapping, that would make the parser simpler.

Hm, perhaps, but I don't see a particular problem with this. This has to
be the easiest kind of message-send to inline.

-- 
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/



More information about the Slate mailing list