Poking through various bit of code I have seen at least four
different idioms for defpackage:
(defpackage bernard
(:nicknames :bern)
(:use :common-lisp))
(defpackage ':bernard
(:nicknames ':bern)
(:use ':common-lisp))
(defpackage #:bernard
(:nicknames #:bern)
(:use #:common-lisp))
(defpackage "BERNARD"
(:nicknames "BERN")
(:use "COMMON-LISP"))
There was a thread last year talking about this but having waded
through it on google, I am not much the wiser. I tend to write
defpackage using the first version. Is this wrong? Does this
intern lots of un-gc'able cruft? and if so should I use the
symbol'd form (that is the ':bernard syntax) or the uninterned
symbol form?
Best Regards,
Will Deakin
* Will Deakin wrote:
> There was a thread last year talking about this but having waded
> through it on google, I am not much the wiser. I tend to write
> defpackage using the first version. Is this wrong? Does this intern
> lots of un-gc'able cruft? and if so should I use the symbol'd form
> (that is the ':bernard syntax) or the uninterned symbol form?
I do this:
(defpackage :foo
...
(:export #:foo1 ...))
I do this because I'd kind of like to say
(defpackage "FOO" ... (:export "FOO1")) but I got bitten badly by this
with ACL code and modern mode. I'd kind of like to use uninterned
symbols everywhere, so (defpackage #:foo ...), but I also type
(in-package ...) quite a lot and I find it's somehow easier to type
(in-paclahe :foo). I use gensyms for the exports because they only
get mentioned once. I don't use unqualified symbols for anything
because I don't like the idea of lots of spurious internage in the
current package.
--tim
* I wrote:
> ...but I also type
> (in-package ...) quite a lot and I find it's somehow easier to type
> (in-paclahe :foo).
This may explain why I end up in the debugger so much...
In ACL we see
cl-users(557): (pprint (macroexpand-1 '(defpackage foo (:nicknames foo) (:use baz))))
(eval-when (compile eval load) (excl::defpackage-1 '#:foo '((:nicknames #:foo) (:use #:baz))))
cl-user(558):
In CMUCL we see for example
* (macroexpand-1 '(defpackage :foo (:nicknames foo) (:use baz)))
(EVAL-WHEN (COMPILE LOAD EVAL)
(KERNEL:%DEFPACKAGE "FOO"
'("FOO")
'NIL
'NIL
'NIL
'("BAZ")
'NIL
'NIL
'NIL
'NIL))
T
*
So I think you should prefer third or fourth forms.
Will Deakin wrote:
>
> Poking through various bit of code I have seen at least four
> different idioms for defpackage:
>
> (defpackage bernard
> (:nicknames :bern)
> (:use :common-lisp))
>
> (defpackage ':bernard
> (:nicknames ':bern)
> (:use ':common-lisp))
>
> (defpackage #:bernard
> (:nicknames #:bern)
> (:use #:common-lisp))
>
> (defpackage "BERNARD"
> (:nicknames "BERN")
> (:use "COMMON-LISP"))
>
> There was a thread last year talking about this but having waded
> through it on google, I am not much the wiser. I tend to write
> defpackage using the first version. Is this wrong? Does this
> intern lots of un-gc'able cruft? and if so should I use the
> symbol'd form (that is the ':bernard syntax) or the uninterned
> symbol form?
>
> Best Regards,
>
> Will Deakin
--
Vladimir Zolotykh ······@eurocom.od.ua