From: Peter Keller on
Pascal J. Bourguignon <pjb(a)informatimago.com> wrote:
> Again, qualification only matters when you are READing a symbol, that
> is, when you are deserializing it. And when you are PRINTing a
> symbol, you can do so READABLY, so that qualification is produced, and
> ambiguity removed.

So, I've gotten a solution to work. The gist of my solution is:

;; on the master process side (transformed example, picked out of a hairy
;; macro which produces it):

(make-structure
:pkge (package-name (symbol-name 'foo))
:func (symbol-name 'foo))

Then I serialize the structure across the network:

;; on the slave process side (don't forget it is the same executable just on
;; a different machine):

(let* ((pkge (structure-pkge struct))
(func (structure-func struct))
(sym-func (intern func (intern pkge :keyword))))

(apply (symbol-function sym-func) args))

Notice the interesting use of intern to get the symbol in the package I need
and then symbol-function to get the contents of said symbol (which I know to be
a function so I don't have to check).

I've also stumbled across some very arcane cases of unexpected symbol
internship into various packages with a macro expanding into a macro across
package boundaries that makes me frustrated. However, it looks like I can avoid
having to understand those arcane cases at the moment with a dirty hack and
finish this aspect of my project.

Thank you very much for your help! It is appreciated and hopefully some of your
knowledge stuck in my brain as it whooshed past.

Later,
-pete
From: RG on
In article <87y6e03xdc.fsf(a)kuiper.lan.informatimago.com>,
pjb(a)informatimago.com (Pascal J. Bourguignon) wrote:

> Peter Keller <psilord(a)cs.wisc.edu> writes:
> > I've run into a hard symbol resolution problem concerning packages and I
> > would
> > request some help in solving it.
> >
> > Let me describe the situation.
> >
> > I have two packages: X and Y.
> >
> > Y uses X and X exports a subset of its symbols.
> >
> > X exports a macro Z which Y uses to create a function sZ in Y. sZ uses
> > symbols
> > out of Y and X.
>
> Wrong! A package doesn't export macros. A package exports symbols!
>
>
> > A function in X is passed the symbol name (only) of sZ, and it needs to
> > invoke
> > it.
> >
> > How?
> >
> > When the codes in X and Y are in the same package, I know how to do this,
> > it is
> > when they are different that I do not.
>
> Packages are totally irrelevant.
>
> Packages are used only at READ-TIME.

That's not true. Packages are *normally* used at read time, but it is
quite possible to use packages at run time.

The OP can do what he says he wants by e.g.

(funcall (symbol-function (find-symbol name (find-package "Y"))))

But except as an exercise, doing this is probably a Really Bad Idea (tm).

rg
From: Scott L. Burson on
On Jun 27, 6:51 pm, Peter Keller <psil...(a)cs.wisc.edu> wrote:
>
> (let* ((pkge (structure-pkge struct))
>        (func (structure-func struct))
>        (sym-func (intern func (intern pkge :keyword))))

You can just say: (intern func pkge)

-- Scott
From: Peter Keller on
Scott L. Burson <gyro(a)zeta-soft.com> wrote:
> On Jun 27, 6:51?pm, Peter Keller <psil...(a)cs.wisc.edu> wrote:
>>
>> (let* ((pkge (structure-pkge struct))
>> ? ? ? ?(func (structure-func struct))
>> ? ? ? ?(sym-func (intern func (intern pkge :keyword))))
>
> You can just say: (intern func pkge)

You are indeed correct. Thanks!

I must say, the things so far I've found really confusing about Lisp are: the
notion of a "package name" and packages in general (I've looked at PCL, but the
explanations are obtuse to me), and backquote/comma interrelations to choose
which evaluation level you'd like something evaluated.

I'm starting, however, to finally grok the concept that packages simply export
symbols, but not necessarily the contents of the symbols, but you can gain
access to the contents if you have the right fully qualified symbol name.

-pete
From: RG on
In article <i092hc$79f$1(a)news.eternal-september.org>,
Peter Keller <psilord(a)cs.wisc.edu> wrote:

> Scott L. Burson <gyro(a)zeta-soft.com> wrote:
> > On Jun 27, 6:51?pm, Peter Keller <psil...(a)cs.wisc.edu> wrote:
> >>
> >> (let* ((pkge (structure-pkge struct))
> >> ? ? ? ?(func (structure-func struct))
> >> ? ? ? ?(sym-func (intern func (intern pkge :keyword))))
> >
> > You can just say: (intern func pkge)
>
> You are indeed correct. Thanks!
>
> I must say, the things so far I've found really confusing about Lisp are: the
> notion of a "package name" and packages in general (I've looked at PCL, but
> the
> explanations are obtuse to me), and backquote/comma interrelations to choose
> which evaluation level you'd like something evaluated.
>
> I'm starting, however, to finally grok the concept that packages simply
> export
> symbols, but not necessarily the contents of the symbols, but you can gain
> access to the contents if you have the right fully qualified symbol name.

Not quite. Packages contain (and export) symbols, period, end of story.
It is not the case that packages don't "necessarily" export the
"contents" of symbols, because this implies that there are circumstances
under which they might "export the contents" of symbols. But that is
not so. There are no circumstances under which packages "export the
contents of symbols." So packages DO NOT "export the contents of
symbols", period, end of story.

The reason I'm putting "contents" in scare quotes is because Lispers
don't generally speak of symbols having "contents", they speak of
symbols having various kinds of BINDINGS, which is almost certainly what
you mean when you say "contents", but you'll be less confused if you
stick with established terminology. Note that bindings are not
first-class data structures, so exporting a binding is not just
impossible, it's non-sensical.

rg