[self-interest] Re: Another question about Self grammar

datique at pcs.usp.br datique at pcs.usp.br
Thu Mar 25 01:43:18 UTC 1999


 <pine.bsf.4.10.9903231253210.3264-10000- at pacman.redwoodsoft.com> wrote: 
Original Article: http://www.egroups.com/list/self-interest/?start=109
> 
> Ok, time for another simple question about Self grammar
> that was probably already asked/answered.
> 
> In a Self expression, the use of the parentheses specifies an object,
> or a higher precedence expression. However, as mentioned earlier, most
> people just parse these as objects. Later in the compiler phase, 
> it can be determined that these parenthesized expressions have no
> temporaries and are just a single expression.
> 
> Example: 
> 
> x + ( (bag getItemNamed: 'dog') squared)
> 
> This whole line is a single expression.
> 
> Is what I am saying correct?
> 
> Dru Nelson
> Redwood City, California
> 
> 
Hello, Dru.
I think I can explain your expression: the first level is parsed as a doIt method, that is, all this expression is parsed into a single method object which is evaluated as if it were a slot of the lobby, right? In fact, I agree when you say that everything in parentheses is parsed as an object: everything in Self is an object or a message sent to an object! One can then distinguish between source method objects, that are the outputs of the parser, consisting of bytecodes and references to literals, and native methods, which are also objects (though VM objects) produced by any of the compilers. 
So, your 
( (bag getItemNamed: 'dog') squared) will be parsed as a source method object, then the messages getItemNamed: and squared will be sent to the appropriate receivers and the resulting value will be sent with the + message to x.
Hope this helps...
Regards,
Douglas

------------------------------------------------------------------------
eGroup home: http://www.eGroups.com/list/self-interest
Free Web-based e-mail groups by eGroups.com




More information about the Self-interest mailing list