does the Oberon-0 have single namespace for all the identifiers or does
it have separate namespace for procedures and normal variables? More
specifically, does the following program work?
PROCEDURE Foo(x: INTEGER);
VAR Foo: INTEGER;
BEGIN
Foo := 10;
Foo(Foo)
END Foo;
I searched the book, but it doesn't seem to discuss this issue
explicitly. Does anyone have any insight on this? I vaguely remember
that Pascal had separate namespaces, but I am not sure.
--
Margus
Looking at the symbol table code (NewObj, find, etc) in the parser module (OSP, page 114) seems to indicate that there is only one name space. All named things seem to be represented by objects created by NewObj and looked up using find.
Tony
Tony is right to look at the code for the answer. One might also
consider what would happen if functions were added to Oberon0 in
addition to the procedures that are there. Since procedures with no
arguments can be called using only their name and no empty parenthesis
(as in "MyProcWithNoArgs ;"), then functions with no arguments would
also be called without parenthesis. Thus having separate names spaces
for function names and variable names would be problematic. So that
may also lead you to believe that procedures and variables do not have
separate name spaces.
Cheers,
Eric