Syntax of GNU Smalltalk class definitions
Stefan Monnier <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.gnu.general |
|---|---|
| Message-ID | <[email protected]> |
I'm trying to understand the syntax of GNU Smalltalk class definitions.
https://www.gnu.org/software/smalltalk/manual/html_node/The-syntax.html
documents the BNF of the bang syntax:
methods: ``!'' id [``class''] ``methodsFor:'' string
``!'' [method ``!'']+ ``!''
But for the "new style" syntax, I can't see how it fits.
From the BNF point of view, it looks pretty much like a method call, but
not quite.
More specifically I thought that in Smalltalk [...] is just a block (aka
closure). So how does Smalltalk know that when I do
Package extend [ ... ]
this [...] should not be a block (or is it still treated as a block,
except that "Package extend" then uses introspection to look inside the
body of the closure and analyze its "source code" to treat it as
something different)?
Better yet: my current understanding of Smalltalk syntax tells me that
"Package extend" is a method invocation with the unary selector
"extend", i.e. it's
(Package extend) [ ... ]
so what is the "operation" that passes [ ... ] to (Package extend)?
I doesn't look like any of the three syntaxes of method invocation
I know (unary, binary, and multiple-keywords)?
Stefan