jed-users mailing list

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

Re: problems with upgrade to 0.99.19 (was Re: More patches)


On 26.05.08, J�rg Sommer wrote:
> "G. Milde" <milde@xxxxxxxxxxxxxxxxxxxxx> wrote:

> >> 2008-05-25 16:46 Jed 0.99.19-138 (utf8), S-Lang 2.1.3, Emulation 'emacs'
> >> test_files in '/usr/share/jed/jed-extra/tests' matching '^[^.].*\.sl$': testing 20 files|dirs 
> >>  ch_table-test.sl: 
> >>   E: 'Open failed' Unable to load /usr/share/jed/jed-extra/unittest.slc in require() /usr/share/slsh/require.sl
> >>  csvutils-test.sl: 
...

> The problem is your require() call in the test files.
...
> Because you load your test files in a namespace, the feature is looked up
> in this namespace and not in the Global namespace or the namespace of the
> unittest file. 

While in Jed 0.99.18 the feature is registered and searched without a
namespace specifier (`private define pop_feature_namespace (nargs)` is
new in slsh's require.sl).

Conclusion: even a plain 

   require("<feature>"); 
   
is not always sure to work the same in 0.99.18 and 0.99.19.


I understand that the behaviour in 0.99.18 is suboptimal, as it may
happen that 

* a file providing <feature> is loaded in a "named namespace" while 
* the <feature> is registered Globally. 

Accessing functions that are provided by <feature> from another
namespace or Global will then fail.

> So your provide should put the feature in the Global namespace 

IMO the namespace argument to provide() is not "the right way". If I
write

   provide("<feature>", "Global");

this would recreate the problem with possible loading into a
different namespace but Globally registered <feature> from 0.99.18.

Care should be taken with the relative placement of the provide() and 
implements() or use_namespace() commands:

  implements("foo");
  provide("bar");
  
provides the feature "foo.bar", while

  provide("bar");
  implements("foo");
  
provides the feature "bar".
(I'll have to screen all my modes for proper implementation. :-( )   

> and the require should look there or your require should look in the
> namespace of the unittest file.

Unfortunately, both 

   require("<feature>", "Global"); 
and
   provide("<feature>", "Global");
      
are not backwards compatible with Jed <= 0.99.18.

So, one of the compatibility hacks:

  #if (_jed_version <= 9918)
  require("unittest");
  #else
  require("unittest", "Global");
  #endif

or

  try:
     require("unittest", "Global");
  except ....     
     require("unittest");

will be needed.

GM

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


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