Subject: Re: why cl packages are hard to use ?
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 12 Dec 2008 03:06:28 -0600
Newsgroups: comp.lang.lisp
Message-ID: <studnU3FrN0JtN_UnZ2dnUVZ_vednZ2d@speakeasy.net>
Ron Garret  <rNOSPAMon@flownet.com> wrote:
+---------------
|  Kaz Kylheku <kkylheku@gmail.com> wrote:
| > Rob Warnock <rpw3@rpw3.org> wrote:
| > > Ron Garret  <rNOSPAMon@flownet.com> wrote:
| > >| P2[19]> (eq 'baz (read-from-string (format nil "~S" 'baz)))
| > >| T
| > >| P2[20]> (eq 'foo (read-from-string (format nil "~S" 'foo)))
| > >| NIL
| > >| 
| > >| How this can happen is left as an exercise for the reader
| > >| (no pun intended).
| > >
| > > O.k, I give up. How?!?  [Assuming that those *are* indeed
| > > successive REPL commands with no intervening operations...]
| > 
| > Ditto. I have not been able to solve the puzzle of how there can be a
| > read-print inconsistency over FOO, but not over BAR (short of some
| > very dirty readtable manipulation or something).
...
| [ron@mickey:~]$ clisp
...
| [1]> (make-package :p1)
| #<PACKAGE P1>
| [2]> (make-package :p2)
| #<PACKAGE P2>
| [3]> (setf s '#:foo)
| #:FOO
| [4]> (import s :p1)
| T
| [5]> (import s :p2)
| T
| [6]> (unintern s :p1)
| T
| [7]> (in-package :p2)
| #<PACKAGE P2>
| P2[8]> 'foo
| #:FOO
| P2[9]> 'baz
| BAZ
| P2[10]>
+---------------

Wow!! That's *really* nasty!!  Worse, now that you've shown the
basic pattern, I find that I can duplicate it[1] *much* more simply:

    cmu> (make-package :p1)

    #<The P1 package, 0/9 internal, 0/9 external>
    cmu> (import 'p1::foo)

    T
    cmu> (unintern 'p1::foo :p1)

    T
    cmu> 'foo

    #:FOO
    cmu> 

Ugh.


-Rob

[1] In CMUCL, at least. Neither your example nor mine works in
    the really ancient CLISP-2.29 I have handy (probably because
    recent versions are more ANSI compatible).

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607