[Openmcl-devel] a function to create a symbol in a given package
Taoufik Dachraoui
taoufik.dachraoui at wanadoo.fr
Wed Jun 3 14:12:03 PDT 2009
On Jun 3, 2009, at 10:56 PM, Robert Goldman wrote:
>
> Taoufik Dachraoui wrote:
>> Hi
>>
>> I tried but could not find a way to create a function that creates a
>> symbol in a given package.
>>
>> I woud appreciate if someone can helpp me write the following
>> function:
>>
>> (defun crate-symbol-in-package (symbol value package)
>> .....)
>>
>> example of use:
>>
>> ? *package*
>> COMMON-LISP-USER
>> ? (create-symbol-in-package 'client 'me 'world)
>> WORLD:CLIENT
>> ? world::client
>> 'ME
>>
>>
>
> How about
>
> (intern "CLIENT" :world)
> (setf world::client 'me)
>
> or, for that matter
>
> (defvar world::client 'me)
>
> what is it that you are trying to achieve here? This
> create-symbol-in-package is so deeply unidiomatic, that I suspect if
> we
> looked at what you are trying to do in context, we will find that it
> can
> be achieved more easily in other ways.
>
> For what purpose do you believe you need this function?
>
I am writing a lisp server that accepts connections from clients; each
client will be assigned a new package at connection.
Each client package will inherit, depending on the client profile,
symbols from other pre-existing packages (applications).
The client will be able to send lisp commands to the server, and the
server will execute the commands in the client's package
(after checking that the commands are valid and do not access any data
outside its assigned package).
At client connection, the server need to save some data related to the
client in the clients package. The pre-existing
functions will be using these data defined by the server on connection.
I am not sure I am using the right strategy, but I am trying my first
ideas, and I hope I will gain more insights on the whole
application to allow me to make better choices to implement this whole
thing.
Kind regards
-Taoufik
More information about the Openmcl-devel
mailing list