I ran into some resolver issues while writing the inotify module. Maybe related to what was on the list a while ago.
The problem seems to be that when using
#if constant(Public.System.Inotify.someconstant)
inside of Public.System.Inotify (using #if constant(someconstant) directly doesnt work in the first place). Compilation works fine but afterworks that constant cannot be accessed in some cases. for instance doing
import Public.System.Inotify; do_something(Public.System.Inotify.someconstant);
does not compile because someconstant cannot be found. I encountered some other problems in various combinations... (with import/without). It still works to index by hand using `[]().
Maybe I should not check for some local constant in a preprocessor directive?
arne
ps. i added the module to gotpike. the constant causing the trouble is IN_MASK_ADD.
I guess you have a cyclic symbol dependency the compiler can't handle. The reason you're just getting an undefined constant afterwards would then be that the compiler has deployed a placeholder object in an attempt to deal with the situation, and indexing such an object resulted in UNDEFINED (which the compiler hoped to correct in the second pass, but failed). That should at least be caught so a compiler error is reported instead, but, well, the resolver is basically broken by design and it has proved very difficult to fix.
You could try to compile your module with -DCOMPILER_DEBUG. Then you'll see the order your files get compiled, which might give you a hint.
(using #if constant(someconstant) directly doesnt work in the first place)
The recursive resolver problems aside, #if constant(.someconstant) might be a better alternative.
pike-devel@lists.lysator.liu.se