Re: [pro] Initialization of shared slots

2011-01-10 Thread Pascal Costanza
On 10 Jan 2011, at 19:58, Samium Gromoff wrote: > On Mon, 10 Jan 2011 18:33:17 GMT, Martin Simmons wrote: >> Another reason why this won't work is that you only have one slot -- the same >> value is shared between every subclass of vcs-type-mixin. Adding a separate >> slot to each subclass is a

Re: [pro] Initialization of shared slots

2011-01-10 Thread Daniel Weinreb
That sounds like a good way for it to work. I'm not sure how safe it would be to depend on each of the extant implementation of Common Lisp to do this. It would probably be best if they all conformed; the only drawback would be the tiny possibility that some code somewhere is depending on the ex

Re: [pro] Initialization of shared slots

2011-01-10 Thread Samium Gromoff
On Mon, 10 Jan 2011 18:33:17 GMT, Martin Simmons wrote: > Another reason why this won't work is that you only have one slot -- the same > value is shared between every subclass of vcs-type-mixin. Adding a separate > slot to each subclass is a pain. Oh, right, my fault here. I remember elaborate

Re: [pro] Initialization of shared slots

2011-01-10 Thread Martin Simmons
> On Sat, 08 Jan 2011 18:07:48 +0300, Samium Gromoff said: > > On Sat, 8 Jan 2011 15:48:33 +0100, Pascal Costanza wrote: > > > > On 8 Jan 2011, at 14:15, Samium Gromoff wrote: > > > > > On Fri, 7 Jan 2011 23:42:23 +0100, Pascal Costanza wrote: > > >> There is no real advantage in having sh

Re: [pro] Initialization of shared slots

2011-01-08 Thread Samium Gromoff
On Sat, 8 Jan 2011 15:48:33 +0100, Pascal Costanza wrote: > > On 8 Jan 2011, at 14:15, Samium Gromoff wrote: > > > On Fri, 7 Jan 2011 23:42:23 +0100, Pascal Costanza wrote: > >> There is no real advantage in having shared slots over global special > >> variables. On top of that, the slot access

Re: [pro] Initialization of shared slots

2011-01-08 Thread Pascal Costanza
On 8 Jan 2011, at 14:15, Samium Gromoff wrote: > On Fri, 7 Jan 2011 23:42:23 +0100, Pascal Costanza wrote: >> There is no real advantage in having shared slots over global special >> variables. On top of that, the slot access protocols in the CLOS MOP >> also don't work that well in conjunction

Re: [pro] Initialization of shared slots

2011-01-08 Thread Pascal Costanza
On 8 Jan 2011, at 11:22, Faré wrote: >>> Daniel Weinreb wrote: >>> - however, nothing tells us that the resulting value is used immediately >>> to initialize the slot (it could just be stored somewhere), and >>> implementations seem to be free to do so right now, or later when the >>> first in

Re: [pro] Initialization of shared slots

2011-01-08 Thread Svante Carl v. Erichsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi! Am 08.01.2011 11:22, schrieb Faré: >>> Daniel Weinreb wrote: >>> - however, nothing tells us that the resulting value is used immediately >>> to initialize the slot (it could just be stored somewhere), and >>> implementations seem to be free to

Re: [pro] Initialization of shared slots

2011-01-08 Thread Samium Gromoff
On Fri, 7 Jan 2011 23:42:23 +0100, Pascal Costanza wrote: > There is no real advantage in having shared slots over global special > variables. On top of that, the slot access protocols in the CLOS MOP > also don't work that well in conjunction with shared slots. So it's > better to avoid them. For

Re: [pro] Initialization of shared slots

2011-01-08 Thread Faré
>> Daniel Weinreb wrote: >> - however, nothing tells us that the resulting value is used immediately >>  to initialize the slot (it could just be stored somewhere), and >>  implementations seem to be free to do so right now, or later when the >>  first instance is created. > > Pascal Costanza wrot

Re: [pro] Initialization of shared slots

2011-01-07 Thread Pascal Costanza
On 6 Jan 2011, at 18:03, Didier Verna wrote: > Daniel Weinreb wrote: > >> This conversation has been good. > > Yup. Here's what I gather from it, mostly: > > - a shared slot's initform is required to be evaluated when the class is > created, I agree here. > - however, nothing tells us that

Re: [pro] Initialization of shared slots

2011-01-07 Thread Martin Simmons
> On Thu, 06 Jan 2011 11:44:13 -0500, Daniel Weinreb said: > > If you have class c1 with shared slots cs1 and cs2, > why not just have two global variables (e.f. defvar) > called *cs1* and *cs2* sitting next to the defclass? > > At least one reason, and maybe the only reason, > is that the in

Re: [pro] Initialization of shared slots

2011-01-06 Thread Daniel Weinreb
Daniel Weinreb wrote: This conversation has been good.  I agree with both Svante and Scott. As is often the case with the spec, it is not quite unambiguous. Oh, and I meant to say that I'm not sure the spec is 100% clear on which forms are evaluated v. not evaluated, and whether there

Re: [pro] Initialization of shared slots

2011-01-06 Thread Didier Verna
Daniel Weinreb wrote: > This conversation has been good. Yup. Here's what I gather from it, mostly: - a shared slot's initform is required to be evaluated when the class is created, - however, nothing tells us that the resulting value is used immediately to initialize the slot (it could ju

Re: [pro] Initialization of shared slots

2011-01-06 Thread Svante Carl v. Erichsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi! Am 06.01.2011 13:56, schrieb Martin Simmons: > On Thu, 06 Jan 2011 10:33:43 +0100, Svante Carl v Erichsen said: >> Am 06.01.2011 01:31, schrieb Scott L. Burson: >>> In section 7.1 it says: "The :initform for a shared >>> slot may be used when defi

Re: [pro] Initialization of shared slots

2011-01-06 Thread Daniel Weinreb
This conversation has been good. I agree with both Svante and Scott. As is often the case with the spec, it is not quite unambiguous. It seems to me that the spec is having trouble deciding whether it is a real, strict, firm language spec, or a useful tutorial/reference documentation aimed at wh

Re: [pro] Initialization of shared slots

2011-01-06 Thread Martin Simmons
> On Wed, 05 Jan 2011 16:17:09 +0100, Didier Verna said: > > Until now, I've been uncounsiously relying on something that the > standard does not seem to specify: the fact that shared slots equipped > with an initform are initialized before the first instance is created: > > (defclass test

Re: [pro] Initialization of shared slots

2011-01-06 Thread Martin Simmons
> On Thu, 06 Jan 2011 10:33:43 +0100, Svante Carl v Erichsen said: > > Am 06.01.2011 01:31, schrieb Scott L. Burson: > > In section 7.1 it says: "The :initform for a shared > > slot may be used when defining or redefining the class." > > I think that this is the most directly applying passage

Re: [pro] Initialization of shared slots

2011-01-06 Thread Martin Simmons
> On Thu, 6 Jan 2011 12:36:48 GMT, Martin Simmons said: > > On Wed, 5 Jan 2011 16:31:31 -0800, Scott L Burson said: > > > > I think the sentence from 7.1.3 that you've quoted is intended to > > apply only to local slots; I think these other two passages make that > > clear by establishing

Re: [pro] Initialization of shared slots

2011-01-06 Thread Martin Simmons
> On Wed, 5 Jan 2011 16:31:31 -0800, Scott L Burson said: > > I think the sentence from 7.1.3 that you've quoted is intended to > apply only to local slots; I think these other two passages make that > clear by establishing that shared slots are indeed initialized at > defclass time. I think

Re: [pro] Initialization of shared slots

2011-01-06 Thread Svante Carl v. Erichsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi! Am 06.01.2011 01:31, schrieb Scott L. Burson: > In section 7.1 it says: "The :initform for a shared > slot may be used when defining or redefining the class." I think that this is the most directly applying passage for this issue. I am not entir

Re: [pro] Initialization of shared slots

2011-01-06 Thread Didier Verna
"Scott L. Burson" wrote: > Oh, and this appears to be a bug in ABCL, since the second passage I > quoted above _requires_ the :initform to be evaluated at defclass > time. That's a good point. -- Resistance is futile. You will be jazzimilated. Scientific site: http://www.lrde.epita.fr/~di

Re: [pro] Initialization of shared slots

2011-01-06 Thread Didier Verna
"Svante Carl v. Erichsen" wrote: > from chapter 7.1.4: > > "If a slot has both an :initform form and an :initarg slot option, and > the initialization argument is defaulted using :default-initargs or is > supplied to make-instance, the captured :initform form is neither used > nor evaluated."

Re: [pro] Initialization of shared slots

2011-01-05 Thread Svante Carl v. Erichsen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello! In chapter 7.1.5, the fourth bullet of shared-initialize is: "Any slots indicated by the second argument that are still unbound at this point are initialized according to their :initform forms." There is no hint that "slots" could refer only

Re: [pro] Initialization of shared slots

2011-01-05 Thread Scott L. Burson
On Wed, Jan 5, 2011 at 7:17 AM, Didier Verna wrote: > Until now, I've been uncounsiously relying on something that the > standard does not seem to specify: the fact that shared slots equipped > with an initform are initialized before the first instance is created: > > (defclass test () ((slot :all

Re: [pro] Initialization of shared slots

2011-01-05 Thread Didier Verna
r...@tuxteam.de wrote: > On Wed, Jan 05, 2011 at 06:15:34PM +0100, Didier Verna wrote: >> >> Tim Bradshaw pointed out that my message was not very clear because the >> test I gave does not demonstrate that an initform's result is used to >> initialize the slot early, only at which time a slot is

Re: [pro] Initialization of shared slots

2011-01-05 Thread rm
On Wed, Jan 05, 2011 at 06:15:34PM +0100, Didier Verna wrote: > > Tim Bradshaw pointed out that my message was not very clear because the > test I gave does not demonstrate that an initform's result is used to > initialize the slot early, only at which time a slot is initialized. > > This on the

Re: [pro] Initialization of shared slots

2011-01-05 Thread Didier Verna
Tim Bradshaw pointed out that my message was not very clear because the test I gave does not demonstrate that an initform's result is used to initialize the slot early, only at which time a slot is initialized. This on the other hand gets closer to the point: (defclass test () ((slot :allocati

[pro] Initialization of shared slots

2011-01-05 Thread Didier Verna
The following message is a courtesy copy of an article that has been posted to comp.lang.lisp as well. Until now, I've been uncounsiously relying on something that the standard does not seem to specify: the fact that shared slots equipped with an initform are initialized before the first instan