Spec. 5.9 Outer Sends not conforming to implementation?

23 views
Skip to first unread message

Stefan Marr

unread,
May 24, 2015, 9:47:30 AM5/24/15
to newspeak...@googlegroups.com
Hi:

Reading the specification section 5.9 on outer sends, I have the feeling it does not conform to the implemented behavior in the Newspeak image.

“”"An outer send consists of the reserved word outer, an identifier N, and a message clause (5.4.2). It is a compile time error if N is not the name of a class whose declaration D lexically encloses the outer send. […]”””

What I take from this specification is that an outer send always has to have the form `outer N s`.
`N` being a class name, and `s` being a message clause.

This is also states as such in the informal description in the next paragraph.

However, in the image, an expression like `^ outer Foo`, where `Foo` refers to an outer class is also accepted.
From the specification, I would have expected that the message clause is not optional.

Is my understanding correct, or am I missing something?

Trying to look at the NS3Grammar, I was also missing this specific part. Actually, outer, self, and super do not seem to be part of this simple version of the grammar.

Thanks
Stefan


--
Stefan Marr
Johannes Kepler Universität Linz
http://stefan-marr.de/research/

Ryan Macnak

unread,
May 24, 2015, 11:05:18 PM5/24/15
to newspeak...@googlegroups.com
On Sun, May 24, 2015 at 6:46 AM, Stefan Marr <goo...@stefan-marr.de> wrote:
Hi:

Reading the specification section 5.9 on outer sends, I have the feeling it does not conform to the implemented behavior in the Newspeak image.

“”"An outer send consists of the reserved word outer, an identifier N, and a message clause (5.4.2). It is a compile time error if N is not the name of a class whose declaration D lexically encloses the outer send. […]”””

What I take from this specification is that an outer send always has to have the form `outer N s`.
`N` being a class name, and `s` being a message clause.

This is also states as such in the informal description in the next paragraph.

However, in the image, an expression like `^ outer Foo`, where `Foo` refers to an outer class is also accepted.
From the specification, I would have expected that the message clause is not optional.

Is my understanding correct, or am I missing something?

That's right. The implementation evaluates 'outer Foo' without a message clause to the enclosing object w/r/t Foo, which is not part of the language spec. The rationale is in the thread "Reserved word sends" from October 2012.

Trying to look at the NS3Grammar, I was also missing this specific part. Actually, outer, self, and super do not seem to be part of this simple version of the grammar.

The implementation doesn't handle this in the parser; instead it's part of NewspeakCompilation`Compiler`Rewriter normalSendNode:.
Reply all
Reply to author
Forward
0 new messages