Possibe bug with namespace and class of same name
Posted: Sun Jan 18, 2009 1:42 pm
The following program fails to compile.
The compiler says 'Line 9: cannot find a definition for Bar in Foo'
If I write "f = Foo.Bar()" the problem persists. But if I change the name of the namespace the problem disappears. This problem showed up when I was trying to put my Prompt class inside a Prompt namespace, so there is no obvious workaround besides changing the name of the workspace to something like PromptUtils.
namespace Foo
class Bar
pass
class Foo
def main is shared
f = Bar() # LINE 9
The compiler says 'Line 9: cannot find a definition for Bar in Foo'
If I write "f = Foo.Bar()" the problem persists. But if I change the name of the namespace the problem disappears. This problem showed up when I was trying to put my Prompt class inside a Prompt namespace, so there is no obvious workaround besides changing the name of the workspace to something like PromptUtils.