Re: package frenzy



Hi Peter,

For starters, presumably you're using READ not READ-LINE as the latter
returns a string, not a symbol. Or you're using READ-LINE and then
INTERN to create a symbol, which is arguably a better plan that using
READ so you don't have to worry about READ reading some other kind of
object.

Actually I'm using (read-from-string "COMMAND extra stuff which ain't important" NIL NIL) which returns COMMAND as a symbol. I initially mispelled this as I thought this was not of major influence on my problem at hand).


At any rate, the problem you're having is that READ and INTERN
both use the runtime value of *PACKAGE* to determine how to
find/intern symbols. So it doesn't matter that ep-internal-fn happens
to be defined in a file that is read with a particular *PACKAGE*--what
matters is what *PACKAGE* is when it is called.

Ok, I agree to you this indeed is the problem and the solution. I just find it a bit difficult for a programmer to make sure symbols are created in the right package. I wonder when calling an internal function, the *package* is not automatically changed to the package to the one in which it was defined.


Thanks for your help!

Joris

.



Relevant Pages

  • Re: Symbols - when are they garbage collected?
    ... home package is often considered to be interning it (certainly it is ... I agree that the CL function INTERN does not do this. ... string as its primary input, ... among Lisp practitioners. ...
    (comp.lang.lisp)
  • Re: trying to understand packages
    ... >> The big gotcha is that the reader will intern a symbol or try to resolve ... In particular, I see strings, symbols, and ... does the defpackage form convert the string usage to ... > doing so in another package because the package ...
    (comp.lang.lisp)
  • Re: how to generate function names
    ... FIND-SYMBOL can't find them in any package. ... INTERN find the symbol if it already was interned, ... (defun defun-my-functions (root) ... taking the package of the root ...
    (comp.lang.lisp)
  • Re: how to generate function names
    ... vector of characters that you are expecting. ... with any package. ... for human inspection of machine written code, ... INTERN looks in the variable ...
    (comp.lang.lisp)
  • Re: Sharpsign-colon ... why here?
    ... The root of the issue is the reader interning symbols in uppercase by ... the COMMON-LISP package). ... with the ANSI default and those who want to use a case preserving Lisp ... case preserving reader will intern the symbol in the provided case ...
    (comp.lang.lisp)