Matthew Astley wrote:
>>> Here's a spec idea: could one declare a thread to be an outcast,
>>> banned from touching any specials or shared lexicals that don't
>>> meet some standard locking mechanism?
> 
> What I was after was some way to avoid accidentally getting hold of
> things that are dangerous.
> 
> On access to variables, it seems Perl takes the opposite approach in
> its current formulation of threading.  From the threads::shared
> manpage for 5.8.7,
> 
>   By default, variables are private to each thread, and each newly
>   created thread gets a private copy of each existing variable.  This
>   module allows you to share variables across different threads [...]
> 
> I haven't investigated what happens when references to thingies (a
> technical term) are passed between threads.  However, this does seem
> to be a flat place to start building "no access to dangerous things".
> 
> There might be some ideas there...
> 
> 
> [...]
>> I don't think so. This would be too intrusive.
> 
> Something could be built to make CL more like the Perl style.  The
> language defines a set of globals and gives access to enumerate others
> that have been added.
> 
> With exceptions for strange things like symbol-macros, it would be
> possible to automatically rebind _all_ those variables during
> spawn-thread.  Perhaps when requested by one of those
> &allow-other-keys

I don't know if I understand what you are proposing. In this code

(let (VALUE)
   (defun s (x)
     (setf VALUE x))
   (defun g ()
     VALUE))

should VALUE be private to each thread? If this is what you are
proposing, although not impossible to implement, I believe that not many 
CL implementors would implement it. And we want a standard that is used
by [almost] all implementations.

Marco

_______________________________________________
Gardeners mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/gardeners

Reply via email to