From: Lars R. N. <lar...@gm...> - 2009-05-18 15:01:46
|
On Mon, 2009-05-18 at 16:57 +0300, Nikodemus Siivola wrote: > 2009/5/18 Lars Rune Nøstdal <lar...@gm...>: > > > Maybe a MAKE-LOAD-FORM for the SB-THREAD:MUTEX type should be added? I > > must admit that I do not fully understand how this works or whether it > > could create problems, but anyway: > > Not a good idea, I think. Consider: I agree. I totally expected DEFCONSTANT to only consider the top-level reference to the CONS to be constant -- so forget I ever mentioned this. > > > (defconstant +id-counter+ > > (cons 0 (sb-thread:make-mutex))) > > This is a bad idea: SBCL will evaluate the initialization form both a > compile and load-time, as explicitly allowed by DEFCONSTANT: this > means you will get an error at load time, and if you accept the new > value you will end up with a new lock, which is probably not what you > want. Yes, I was only looking at the behavior of COMPILE-FILE here. I.e., I did not call LOAD. > You want either DEFVAR or DEFGLOBAL. Yeah. SB-EXT:DEFGLOBAL it is. :) CL:DEFCONSTANT is much "stronger" than I thought. I was expecting CL:DEFCONSTANT to behave somewhere in-between CL:DEFCONSTANT and SB-EXT:DEFGLOBAL. For reference, here is the link you mentioned on IRC: http://www.lispworks.com/reference/HyperSpec/Body/03_bd.htm > > Cheers, > > -- Nikodemus > |