The file ns.pure contains:
using system; namespace ns; foo x = puts $ str x; ::bar1 x = foo x; ::bar2 x = ns::foo x;
At the prompt I get:
play$> pure -w Pure 0.49 (i686-pc-linux-gnu) Copyright (c) 2008-2011 by Albert Graef (Type 'help' for help, 'help copying' for license information.) Loaded prelude from /usr/local/lib/pure/prelude.pure.
> using ns; ns.pure, line 6: undeclared symbol '::bar1' ns.pure, line 7: undeclared symbol '::bar2' > show ns::foo ns::foo x = puts (str x); > show bar1 > show bar2 > show ns::bar1 > show ns::bar2
> sysinfo; "i686-pc-linux-gnu"
I expected bar1 and bar2 to be defined in the global namespace.
Is this a bug?
Comment #1
Posted on Nov 16, 2011 by Massive PandaNot a bug. See http://docs.pure-lang.googlecode.com/hg/pure.html#symbol-lookup-and-creation. You're trying to introduce new qualified identifiers outside their home namespace, which is forbidden. The solution is to just declare the symbols in their proper namespace beforehand:
using system; public bar1 bar2; namespace ns; foo x = puts $ str x; ::bar1 x = foo x; ::bar2 x = ns::foo x;
Status: Done
Labels:
Type-Other
Priority-Medium