[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] Syntax of GNU Smalltalk class definitions
From: |
Stefan Monnier |
Subject: |
[Help-smalltalk] Syntax of GNU Smalltalk class definitions |
Date: |
Fri, 26 Apr 2019 08:23:26 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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
- [Help-smalltalk] Syntax of GNU Smalltalk class definitions,
Stefan Monnier <=