[Oberon] Oberon-2 type bound procedure scope
Diego Sardina
dsar at eml.cc
Thu Dec 7 01:43:54 CET 2023
On Wed, Dec 6, 2023, at 23:54, Stefano Ferrari wrote:
>
> Consider a type bound procedure declaration
>
> PROCEDURE (tree: Tree) AddNode(node: Node);
>
> Where does the procedure scope start?
> Identifier ‘tree’ (receiver) belongs to the procedure scope, identifier ‘AddSymbol’ belongs to outer scope and then identifier ‘node’ belongs to procedure scope again
>
> Weird, isn’t it?
>
Ciao Stefano :-)
I don't generally see a big problem with that syntax, except maybe in an extreme single-pass compiler where the scope is built at the symbol level. Even in that case once you see the first "(" you know that it's a type bound procedure and you expect a parameter that will be part of the scope of the following procedure declaration.
Why do you consider it so weird?
--
Diego Sardina
More information about the Oberon
mailing list