Re: Macros and symbols across packages



On 28 May 2005 23:00:32 -0700, "Jeff M." <massung@xxxxxxxxx> wrote:

> I'm curious if there is a method of making sure that symbols will
> evaluate "properly" across packages for use in a macro. For example,
> I have a package that will generate ARM assembly code like so:
>
> (addne r0 r0 r1 :lsl 4) => #x...
>
> Of course, when I use these macros from outside the ARM package,
> though, none of my symbols (registers) match those in the ARM
> package.

You could look at the symbol's /name/ only. This is basically what
LOOP does.

* (make-package :foo)

* (loop foo::for x foo::below 3 foo::collect x)

(0 1 2)

Cheers,
Edi.

--

Lisp is not dead, it just smells funny.

Real email: (replace (subseq "spamtrap@xxxxxxxxxx" 5) "edi")
.



Relevant Pages

  • Re: flets in macros
    ... >> use a walker, and that's the best way to do what you are advocating. ... > not explicitly mentioned by the user of the macro. ... > from a package that I defined. ... can lead to an equally vehement qualitative judgement in the opposite ...
    (comp.lang.lisp)
  • Re: flets in macros
    ... >> can use the same symbol both as a LOOP keyword and for your own ... not explicitly mentioned by the user of the macro. ... from a package that I defined. ... And if he uses a tree walker he has to explicitly decide which symbols ...
    (comp.lang.lisp)
  • Re: packages and symbols mystery
    ... Because it is is a macro, but I'm still learning macrology and that's ... Switching to another package ... Easy to use as no extra knowledge or configuration of Emacs necessary. ... - 2 key-strokes for quotes ...
    (comp.lang.lisp)
  • Re: Macros and symbols across packages
    ... > Of course, when I use these macros from outside the ARM package, ... none of my symbols match those in the ARM package. ... Modify the instruction macro to always intern register symbols into ... > (as I have a lot of assembly code already in place -- I just recently ...
    (comp.lang.lisp)
  • Re: Lisp mistakes in Python
    ... So if you are okay with generic function, ... Sometime macro is too easy to ... I may add Package issue in Common Lisp. ... Being able to calculate things at compile time is a neat trick but, ...
    (comp.lang.lisp)