Re: [CEDET-devel] eieio questions
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2010-02-02 02:50:55
|
Hi Joakim, My answers are a bit brief having not tried much. Perhaps they will help, but if not I can dig in more later. On 01/31/2010 04:51 PM, jo...@ve... wrote: > jo...@ve... writes: > >> I have a scanner front-end package called "emsane". >> >> I would now like to start using eieio in the code rather than a messy >> list structure I'm currently using. >> >> I include some tentative code below. >> >> I have some issues: >> >> - when using "clone" my new instance doesnt seem to wind up on >> emsane-section-presets-list. why not? Was there something wrong with >> the multiple inheritance in my code? The instance tracker doesn't account for 'clone', and clone doesn't call initialize instance. I would take a guess that instance tracker needs to overload clone the same way it handles initialize instance. I don't think 'clone' is part of CLOS, so we can do whatever we need to to get this trick working. > This method definition seems to help: > > (defmethod clone ((obj emsane-section-preset)&rest params) > (let ((theclone (call-next-method))) ;;we want clone for eieio-instance-inheritor to execute now > (initialize-instance theclone) ;;becase clone doesnt do object init, and we want instance tracking > theclone)) Yes, getting clone to call initialize-instance will also help here. > > Should this be further generalized to: > (defmethod clone ((obj eieio-instance-inheritor)&rest params)...) > > WDYT? This seems like the next logical step, and would maximize compatibility with the 'clone' method. If you would like to try that hack and let me know how it goes, that would be spiffy. >> >> - Ideally I would like to support customize, since there are gazillions of >> scanner presets. Is there some support for eieio-instance-inheritor and customize? EIEIO has a customization support system. Just add :custom, :label and :group keys to any slot, and you can customize the object either in place, or in a variable. EDE uses this extensively. In some CEDET project, type "M-x customize-project" to get a feel for it. For classes with oodles of slots, you can organize them into various groups, and the user can edit those slots in the usual way. I expect you will want the customize in place model. >> - Also, is there some existing support in eieio-instance-inheritor for >> fields that are either a function symbol or a value? EIEIO currently treats some function handles specially for an old bogus feature that needs to be removed, so if it isn't working it may be due to this interference. Good Luck Eric |