[armedbear-devel] Package redefinition issue in REPL.

Zach Beane xach at xach.com
Wed Apr 25 11:01:07 UTC 2012


wl chiu <wlclive at live.com> writes:

> Hello dear developers,
>
> I' just experienced an odd issue with defpackage.  It looked like the package
> will not be modified if I call defpackage again.
>
> For example, I define a package called "a-package".  After a while I wanted to
> export a function that I've just implemented called "a-new-foo".  Naturally I
> would add a new entry under the :export section of defpackage, and then eval
> the expression again.  However, I still cannot access "a-new-foo" as the REPL
> gives me "such symbol is not external of package [a-package]" error message.
>
> Please advice and many thanks,

I don't know what the intent of ABCL is, but this behavior is allowed by
the specification of DEFPACKAGE:

    If defined-package-name already refers to an existing package, the
    name-to-package mapping for that name is not changed. If the new
    definition is at variance with the current state of that package,
    the consequences are undefined; an implementation might choose to
    modify the existing package to reflect the new definition.

You can modify the export status of a symbol reliably at runtime with
the EXPORT function.

Zach




More information about the armedbear-devel mailing list