From: Joel Reymont
Subject: Creating "callback" modules
Date: 
Message-ID: <1122066348.927979.26450@g44g2000cwa.googlegroups.com>
Folks,

I would like to let people create trading strategies and let them load
these into my engine. The strategy modules must export a precise set of
functions that I will be calling later.

Is there a way to check for this when evaluating the file or loading in
a fasl?

What is the best way to load the code, make sure that it has the needed
functions and then store it for later execution?

Can I create a package on the fly to load the code into?

    Thanks, Joel

From: Joel Reymont
Subject: Re: Creating "callback" modules
Date: 
Message-ID: <1122074746.729350.315840@g43g2000cwa.googlegroups.com>
Nothing like answering my own question :-)...

I guess I must require that the package name be the same as the
source/fasl file name. Then I can try to import the function from the
package and check to see if it's bound. Presto!

Can I "introspect" a package, though?
From: Kent M Pitman
Subject: Re: Creating "callback" modules
Date: 
Message-ID: <uzmse8ghn.fsf@nhplace.com>
"Joel Reymont" <······@gmail.com> writes:

> Nothing like answering my own question :-)...
> 
> I guess I must require that the package name be the same as the
> source/fasl file name. Then I can try to import the function from the
> package and check to see if it's bound. Presto!
> 
> Can I "introspect" a package, though?

I haven't a clue what you're asking, but I'm pretty sure the answer is yes.

I also doubt you should. ;) I personally would not make this package-driven.

Why not instead have a definition form of some kind that is in the
file that allows someone to offer the interfaces you want by name,
so they can use what names they are comfortable with and so that you
can have more than one in a file and so that if you're debugging 
interactively you can do so without being in a file?

e.g.
  (def-frob
    :foo-callback my-foo-callback
    :bar-callback my-bar-callback
    ...)

It also means you can offer defaults more easily.
From: Joel Reymont
Subject: Re: Creating "callback" modules
Date: 
Message-ID: <1122109328.494982.294400@o13g2000cwo.googlegroups.com>
I was asking if it was possible to find the package(s) defined in the
loaded Lisp file and the exports of those packages.

I would love to let people offer the interfaces I want by name but...
how do I find the interfaces that they have defined?

Answering my own question... I guess the def-frob could register those
interfaces, i.e. add them to my internal list that I would then loop
through.
From: M Jared Finder
Subject: Re: Creating "callback" modules
Date: 
Message-ID: <wKGdnXtdNqh1-H_fRVn-iQ@speakeasy.net>
Joel Reymont wrote:
> I was asking if it was possible to find the package(s) defined in the
> loaded Lisp file and the exports of those packages.
> 
> I would love to let people offer the interfaces I want by name but...
> how do I find the interfaces that they have defined?
> 
> Answering my own question... I guess the def-frob could register those
> interfaces, i.e. add them to my internal list that I would then loop
> through.

Precisely.  Think about how defun works.  There's no reason you couldn't 
make your own hash table of symbols to frobs and provide a symbol-frob 
function.

   -- MJF