[slang-users] Bug in namespace allocation
Jörg Sommer
joerg at alea.gnuu.de
Fri Oct 7 18:56:39 EDT 2005
Hello John,
John E. Davis schrieb am Fri 07. Oct, 11:48 (-0400):
> I am not convinced that it is a problem. For example, try removing
> the implements line from test1.sl. You will find it works:
>
> $ slsh /tmp/test.sl
> _test
> bar
But this leads to very strange errors:
#v+
$ cat /tmp/test.sl
autoload("foo", "/tmp/test1.sl");
autoload("_test->bar", "/tmp/test1.sl");
define bar()
{
message("bar not in test1.sl");
}
bar();
foo();
bar();
_test->bar();
message("");
foreach (_get_namespaces())
{
loop ( _apropos( (), "bar", 0xF) ) {
"->"; exch();
() + () + ();
message( () );
}
}
$ cat /tmp/test1.sl
% try whether reevaluation works in SLANG 2
% implements("_test");
message(current_namespace());
public define foo()
{
message("foo");
}
define bar()
{
message("bar");
}
$ slsh /tmp/test.sl
bar not in test1.sl
foo
bar
_test
bar
_test->bar
Global->bar
#v-
Global->bar from test.sl gets overwritten because no namespace is given
to the autoload() for foo. So you can't refer to the public functions in
a unit with autoload(), otherwise other functions in the Global namespace
may become overwritten.
Regards, Jörg.
--
Perfection is reached, not when there is no longer anything that can be
added, but when there is no longer anything to take away.
(Antoine de Saint-Exupery)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 477 bytes
Desc: not available
Url : http://mailman.jtan.com/pipermail/slang-users-l/attachments/20051008/f9dbc0c9/attachment.bin
More information about the slang-users-l
mailing list