Re: defclass :initform behavior
"Eric M. Ludlam" <[email protected]> Sun, 10 Jun 2012 11:13:37 -0400
| Newsgroups | gmane.emacs.eieio |
|---|---|
| Message-ID | <[email protected]> |
On 06/09/2012 04:40 PM, David A. Thompson wrote: > At Sun, 03 Jun 2012 20:27:35 -0400, > Eric M. Ludlam wrote: >> The cache is a performance tweak so that new classes are just a vector >> copy instead of running a bunch of initialization code. As such, there >> is an instance being created, it's just not one you created yourself. > > This is really the issue. If CLOS behavior is to be emulated, DEFCLASS > has no business creating an instance -- especially not in a manner > which generates side-effects associated with an :INITFORM form. Indeed. The problem is just that two independent features went in and there was no test for this case so it slipped by. Unfortunately, that means it will be tricky to undo the problem without breaking the performance feature. For example, how do you get the default value of a slot without running the code? You can't pre-calculate the default value, because that too will run the code. When an object is saved, it only saves the slots that have changed. That means save will run the default initform too when it checks. I am not really a CLOS expert to know what it is supposed to do in these cases. Eric ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/