[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax ambiguities.
Do you know that there is a Self 4.0?
It is available at our WEB site (http://self.sunlabs.com).
Maybe the manual is clearer.
Anyway here are the specific answers (hope they help):
(| mySlot = ( randomNumber ) |)
This creates an object with one slot, "mySlot" containing
a method that sends randomNumber to self.
Informal rule: slot initializers enclosed in parens parse as methods.
aVar: ( randomNumber )
sends random Number to self and then sends aVar to self with the result
as its argument.
Rule: in the body of a method, parens are just for grouping.
Finally:
foo.bar is always parsed as a resend.
If you want a statement separator, you must leave a space (I think).
(foo. bar)
Rule: always leave a space (or newline, etc)
after a period used as a statement separator.
Good luck!
At 3:16 PM 9/2/96, Pierre De Pascale wrote:
>Hello selfer's,
>
>I have read the self 3.0 reference manual and stopped at the appendix
>where the syntax of the self language was presented. In particular the
>syntax presented is highly ambiguous, but a small foot-note says that
>the ambiguities are resolved using standard precedence techniques.
>
>But I still got some problems:
>
>1. when you initialize a slot. How do you determine if it is a method
>or a simple value ? for example:
>
> (| mySlot = ( randomNumber ) |)
>
>what is the meaning of the mySlot initialization: do I initialize
>mySlot with a one-time call to randomNumber (i.e. mySlot is a value
>slot) or mySlot returns a new randomNumber everytime (i.e mySlot is a
>method) ?
>
>2. a same kind of ambiguities appears in expressions: what is the
>meaning of this expression ?
>
> aVariable: ( randomNumber )
>
>Do I initialize aVariable with one random number, in this case () are
>for precedence reason, or with the object "(randomNumber)", in this
>case a method object.
>
>3. how can you detect a resend ? for example:
>
> myResendSlot.resendMethod
>
>This could be interpreted as a directed resend or two expressions
>consisting of two method sends, one myResendSlot and one
>resendMethod. How do you make the difference ? is there a runtime
>decision of the meaning ?
>
>It may be possible that those issues were already discussed in this
>mailing list. Since I subscribed only lately I was lazy enough not to
>check the past issues. Just tell me if I need to kick myself :^)
>
>thanks,
>
>- Pierre.
-- Dave