From: Delaregue
Subject: macros & packages
Date: 
Message-ID: <6b4aa54a.0403131356.96304c@posting.google.com>
I have a macro and several classes defined in one package, "package1".
This macro makes instances of classes defined in "package1".

When I call package1::macro in a different package, say "package2",
the code in "package2" cannot see the definition of the classes
defined in "package1", resulting in an error.

I am unsure on how to best solve this problem. Should I fully qualify
the classes in the macro code or import the class definition in
"package2"?

Thanks.

From: Kenny Tilton
Subject: Re: macros & packages
Date: 
Message-ID: <pbN4c.16051$c73.5847236@twister.nyc.rr.com>
Delaregue wrote:
> I have a macro and several classes defined in one package, "package1".
> This macro makes instances of classes defined in "package1".
> 
> When I call package1::macro in a different package, say "package2",
> the code in "package2" cannot see the definition of the classes
> defined in "package1", resulting in an error.
> 
> I am unsure on how to best solve this problem. Should I fully qualify
> the classes in the macro code ...

In what macro code? package1::macro? You don't need qualifiers in the 
p1-macro. are you accessing the generated instances via package1 symbols 
after the macro returns? You might have to post some code.

or import the class definition in
> "package2"?

Anyway, you seem to want in-line package2 code to get at package1 
symbols, so yes, export them from package1 and have package2 use 
package1, or import them if you like. But I am not altogether sure from 
your description of the problem what you are doing, since you talk about 
qualifying them inside the macro as a solution.

Consider reducing it all to a ten-line demo of the problem and posting 
that. Always a good idea, since generally you'll work out a solution in 
the process, and if not the help you get will be better.

kt



-- 
http://tilton-technology.com

Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film

Your Project Here! http://alu.cliki.net/Industry%20Application
From: Pascal Bourguignon
Subject: Re: macros & packages
Date: 
Message-ID: <87ad2kuzdg.fsf@thalassa.informatimago.com>
·········@netscape.net (Delaregue) writes:

> I have a macro and several classes defined in one package, "package1".
> This macro makes instances of classes defined in "package1".
> 
> When I call package1::macro in a different package, say "package2",
> the code in "package2" cannot see the definition of the classes
> defined in "package1", resulting in an error.
> 
> I am unsure on how to best solve this problem. Should I fully qualify
> the classes in the macro code or import the class definition in
> "package2"?

Yes.

-- 
__Pascal_Bourguignon__                     http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/
From: Delaregue
Subject: Re: macros & packages
Date: 
Message-ID: <6b4aa54a.0403140413.664267fb@posting.google.com>
·········@netscape.net (Delaregue) wrote in message news:<··························@posting.google.com>...
> I have a macro and several classes defined in one package, "package1".
> This macro makes instances of classes defined in "package1".
> 
> When I call package1::macro in a different package, say "package2",
> the code in "package2" cannot see the definition of the classes
> defined in "package1", resulting in an error.
> 
> I am unsure on how to best solve this problem. Should I fully qualify
> the classes in the macro code or import the class definition in
> "package2"?
> 
> Thanks.

I found the problem. I've modified the reader to create instances of
object names found in a file. I had to intern the object name found in
the file in the right package in order to be able to create my
instances.

Thanks for your help.
From: Kenny Tilton
Subject: Re: macros & packages
Date: 
Message-ID: <Gq_4c.20672$tP6.5790298@twister.nyc.rr.com>
Delaregue wrote:
> ·········@netscape.net (Delaregue) wrote in message news:<··························@posting.google.com>...
> 
>>I have a macro and several classes defined in one package, "package1".
>>This macro makes instances of classes defined in "package1".
>>
>>When I call package1::macro in a different package, say "package2",
>>the code in "package2" cannot see the definition of the classes
>>defined in "package1", resulting in an error.
>>
>>I am unsure on how to best solve this problem. Should I fully qualify
>>the classes in the macro code or import the class definition in
>>"package2"?
>>
>>Thanks.
> 
> 
> I found the problem. I've modified the reader to create instances of
> object names found in a file. I had to intern the object name found in
> the file in the right package in order to be able to create my
> instances.

uh-oh, I was afraid this would happen. :) I think you got some code to 
work, but possibly (can't be sure because you are not posting any code) 
you have forced a square peg into a round hole.

kt

-- 
http://tilton-technology.com

Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film

Your Project Here! http://alu.cliki.net/Industry%20Application