Re: package frenzy



On 2005-05-30 14:23:50 +0200, "Paul F. Dietz" <dietz@xxxxxxx> said:

I'd like to use them to avoid nasty things like name-clashes (that's what they're for, right?).

No, you absolutely should use packages.

Ok, so we tend to agree :).


Let's say I have some package :exporting-package, which has two functions: ep-internal-fn and ep-external-fn. The ep-internal-fn gets a string as argument and returns a symbol using (read-line str NIL NIL). The ep-external-fn uses eq to compare the result of ep-internal-fn with a pre-programmed symbol 'TEST. The ep-external-fn is exported.

Now another package is defined :importing-package which uses the :exporting-package (use-package). When ep-external-fn is called, the equality is always false. This happens because the result of ep-external-fn is a symbol in the package :importing-package, whereas the 'TEST symbol is defined in the :exporting-package.

That symbol was part of the API of the exported function, so it itself should have been exported also. Or, you could have used a keyword symbol.

Maybe, I was a bit unclear with my problem statement. The symbol is not part of the API and should remain unvisible for the users of :exporting-package. So I guess what I want to do is to make sure that the result of the call to the read-line fn returns a symbol inside the :exported-package, but I don't know how to do so. Both ep-internal-fn and ep-external-fn are defined in the package :exporting-package (using in-package).


Paul

Thanks for your support!

Joris


.