[tbnl-devel] Re: [Lispweb] tbnl: what package?

Jim Prewett download at hpc.unm.edu
Fri Feb 10 13:25:45 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


I'm guessing this is what I just ran into and the answer is your new 
function names and symbols will be interned in :CL-USER :)  I'd love to 
know how to change that, but haven't bothered to dig yet.  (in my case, 
:CL-USER would be my second choice after one of my own packages) 

In my case, I had code that uses the multi-method dispatch mechanism to 
display the right page (I'm not yet sure if thats a good idea :) something 
like this:

(defmethod display-page (page-name (eql 'login-page))
	... )

To convert the text strings given by the user into the right symbol (so 
this dispatch mecnhanism can work), I must intern them in the :CL-USER 
package.

This did take me a while to figure out and *I* couldn't find it in the 
documentation anywhere.  (I guess, maybe, it should have been obvious, but 
I still consider myself mostly a Lisp newbie).  I believe my CMUCL Lisp 
starts with a core file causing it to start in :Jims-PackageA, then I've 
been loading a file (that causes TBNL and all that good stuff to be 
loaded) and immediately switching to :Jims-PackageB, so it was really 
confusing to be using the :CL-USER package at all. :)

I hope this helps,
Jim

James E. Prewett                    Jim at Prewett.org download at hpc.unm.edu 
Systems Team Leader           LoGS: http://www.hpc.unm.edu/~download/LoGS/ 
Designated Security Officer         OpenPGP key: pub 1024D/31816D93    
HPC Systems Engineer III   UNM HPC  505.277.8210

On Fri, 10 Feb 2006, Edi Weitz wrote:

> [This is probably better asked on the TBNL mailing list.]
> 
> On Fri, 10 Feb 2006 21:15:19 +1000, Igor Plekhov <penguin at ocean.vvo.ru> wrote:
> 
> > In TBNL some functions are created to handle incoming requests.
> 
> Functions are created?  You're talking about your own handlers or
> something else?
> 
> > What package are they executed in?  I.e. what package *PACKAGE* is
> > bound to?  How can I control it?
> 
> In your own functions you can rebind *PACKAGE* to your liking.
> 
>   (let ((*package* (my-function)))
>     ;; do something
>     )
> 
> For existing TBNL functions the package shouldn't matter with the
> exception of READ-FROM-STRING* the behaviour of which is documented:
> 
>   <http://weitz.de/tbnl/#read-from-string*>
> 
> Does that answer your question or am I misunderstanding?
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Made with pgp4pine 1.76

iD8DBQFD7JRhv/zdxjGBbZMRAiLAAKCOXmJCkb90Iggd3184shHqXFTRwACfRTsS
EHOz1zmgJHMTN9rD0QToHDk=
=qR6P
-----END PGP SIGNATURE-----




More information about the Tbnl-devel mailing list