slang-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] slang 2.0.1 released


Paul Boekholt <p.boekholt@xxxxxxxxx> wrote:
>How compatible is this supposed to be?  I linked JED with it, but am

I have tried to make it as backward compatible as possible.  But the
previous implementation was flawed and had to be fixed, even if it
introduced problems like what you have experienced.  Nevertheless, I
believe that such cases will be rare.

>Also something like
>static variable mode = "help";
>
>if (_featurep(mode))
>  use_namespace(mode);
>else
>  implements(mode);
>provide(mode);
>
>now gives the error "mode is undefined".

What is happening is that "mode" is declared before a static namespace
has been created.  As a result, it ends up in the private or anonymous
namespace.  A side-effect of the implements function is that it
creates a new private namespace.  (I can go into details why this is
necessary if you like).  This means that mode will no longer be
accessable after the call to implements.

If you always want this code to use the "help" namespace, then I think
that it is better to load the file with the namespace specified, e.g.,
 
   () = evalfile ("foo", "help");

I believe that the semantics of namespaces in slang-2 is much better
than in slang-1.  The fact that previously you had to use

   if (_featurep(mode))
     use_namespace(mode);
   else
     implements(mode);

For slang2, it is better to have the "loader" specify the namespace as
an optional argument to "evalfile" or "require".  Then you can
eliminate the above tests altogether.

  Note: JED's require function needs to be updated to take a namespace
  argument.  For that, I plan to use slsh's version.

--John

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]