[armedbear-devel] How do I release ABCL's "package-lock"?
Alessio Stalla
alessiostalla at gmail.com
Wed Dec 30 11:47:06 UTC 2009
On Wed, Dec 30, 2009 at 7:18 AM, Peter Olsen <pcolsen at gmail.com> wrote:
> I'm writing to ask how to redefine the "or" macro in ABCL.
> I'm working on a project and there's one package in which I need "or" to
> mean something else than its usual definition. I've tried simply to
> redefine it, but it doesn't work. I understand that the Common Lisp spec
> requires special provision for that to be done --- such as the package-lock
> construct in SBCL.
> How can I do that in ABCL? I want to be able to do this within the code,
> for example, with in a "let" so that I can bound its scope.
> Can anyone point me in the right direction? My first --- failed ---
> experiment is below.
In addition to what Erik said, if you need you own OR to be effective
only in your package, you can use your-package:or instead of
common-lisp:or to name your macro, for example:
(defpackage :my-package
(:use :common-lisp)
(:shadow #:or)
(:export ...))
then, start your source files with
(in-package :my-package)
and in one of them put
(defmacro or ...) ;the symbol is my-package:or, not common-lisp:or
Of course, this way your macro will only get used by your own code
(and code that imports the symbol OR from your package); it won't
affect other libraries or the system itself, so it's not equivalent to
Erik's advice.
This solution has the advantage of being portable Common Lisp.
hth,
Alessio
More information about the armedbear-devel
mailing list