[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

the KEYWORD package USEing another package



    Date: 1 Mar 1988 11:54-EST
    From: NGALL@G.BBN.COM
	
	Date: Mon, 29 Feb 88 23:08 CST
	From: David Vinayak Wallace <Gumby@MCC.COM>
	...
	Yes there is a problem: you could cause a symbol to be available as a
	keyword whose value was not the keyword.  E.g:
    
    1	(setf user::keyword-example nil) ==> nil
    2	(export 'user::keyword-example) ==> t
    3	user:keyword-example ==> nil
    4	(use-package '(user) (find-package 'keyword)) ==> t
    5	:keyword-example ==> nil

    What makes you think that reading and evaluating :keyword-example
    results in NIL?  Pg 175: "Any symbol preceded by a colon but no
    package name ... is added to (or looked up in) the KEYWORD package as
    an EXTERNAL symbol."  After form 4, user:keyword-example is accessible
    only as an INTERNAL symbol in the KEYWORD package.  Therefore,
    according to my interpretation of the preceding quote, whatever
    mechanism "looks up" keyword::keyword-example (aka
    user:keyword-example) would EXPORT it from the KEYWORD package,
    thereby making it PRESENT in the KEYWORD package, and thereby causing
    it to become a constant whose value is itself (all on pg 175).  Thus
    the value of form 5 would be printed as :keyword-example.

Should user::keyword-example now be nil or :keyword-example?

I actually tried the forms above in Symbolics Common Lisp and they
behave the way my example does.  It's apparently a "bug" in that if you
poke around with FIND-SYMBOL you discover that the user:keyword-example
symbol is NOT exported from the keyword package.

I say "bug" because this behaviour should not really be defined.  Should
making KEYWORD USE another package really change the value cells of the
inherited symbols?  Or worse yet, according to your explanation above,
it shouldn't change the value until the symbol was read through the
KEYWORD package!?  Plus you can end up with keywords with something in
their function cells, which always makes me queasy.

david