[Ecls-list] Package locks and symbol-package
Zach Beane
xach at xach.com
Wed Oct 10 01:17:22 UTC 2012
Matthew Mondor <mm_lists at pulsar-zone.net> writes:
> On Tue, 9 Oct 2012 19:55:52 -0400
> Matthew Mondor <mm_lists at pulsar-zone.net> wrote:
>
>> ECL:
>>
>> (make-package :foo) -> #<"FOO" package>
>> (defparameter foo::gentemp 10) -> GENTEMP
>> (symbol-package 'foo::gentemp) -> #<"COMMON-LISP" package>
>
> Also:
>
> SBCL:
> * (make-package :foo)
>
> #<PACKAGE "FOO">
> * (in-package :foo)
>
> #<COMMON-LISP:PACKAGE "FOO">
> * (cl:import (cl:make-symbol "GENTEMP"))
>
> COMMON-LISP:T
> * (cl:describe 'gentemp)
>
> FOO::GENTEMP
> [symbol]
> * (cl:symbol-package 'gentemp)
>
> #<COMMON-LISP:PACKAGE "FOO">
>
>
> ECL:
>
>> (make-package :foo)
>
> #<"FOO" package>
>> (in-package :foo)
>
> #<"FOO" package>
> FOO> (cl:import (cl:make-symbol "GENTEMP"))
>
> Condition of type: SIMPLE-PACKAGE-ERROR
> Cannot import the symbol #:GENTEMP from package #<FOO package>,
> because there is already a symbol with the same name
> in the package.
>
> Available restarts:
>
> 1. (CONTINUE) Ignore conflict and proceed
> 2. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
>
> Broken at SI:BYTECODES. [Evaluation of: (IMPORT (MAKE-SYMBOL "GENTEMP"))] In: #<process TOP-LEVEL>.
>
>
> New ECL session:
>
>> (make-package :foo)
>
> #<"FOO" package>
>> (symbol-package 'foo::gentemp)
>
> #<"COMMON-LISP" package>
>
>> (foo::gentemp)
>
> T0
>
>
> So if I understand, a virgin package automatically uses CL?
The default package use list if :use is not provided is
implementation-defined. SBCL is unique (I think) in using the empty
list. Historically other Lisps had at least the CL package and possibly
others in the default list.
If you want to have more predictability, provide an explicit :use nil in
make-package or (:use) in defpackage.
Zach
More information about the ecl-devel
mailing list