Prev: A link to a collection of tutorials on LISP.
Next: Can elisp call C functions without recompilation of emacs?
From: Kenneth Tilton on 29 Jun 2010 06:33 Christophe Rhodes wrote: > "Scott L. Burson" <gyro(a)zeta-soft.com> writes: > >> On Jun 28, 12:09 am, Pascal Costanza <p...(a)p-cos.net> wrote: >>> On 28/06/2010 01:00, Scott L. Burson wrote: >>> >>>> For those with more MOP experience than I, what's the easiest way to >>>> programmatically add a slot to an existing class? >>> The situations were you may want to do this are usually extremely rare. >>> So it may be useful to tell us what you want to achieve, so we can maybe >>> come up with better solutions. >> I just wanted to extend a class whose definition I don't control. I >> could just load a patch containing the DEFCLASS form with my slot >> added -- I do have access to the original DEFCLASS form -- but then if >> it changed, I would have to update my patch. Doing it this way makes >> it reasonably upgrade-proof. > > For what it's worth: I'd be tempted to add in a superclass mixin > containing your slot, rather than patch in the slot directly; the effect > is basically the same, but maybe marginally more upgrade-proof? > > However, is this not a sign that something somewhere else isn't quite > right? Yes! > The "normal" way to do this would be to arrange that you use a > subclass of the original class, creating instances of that class and > passing them around, or (if necessary) change-classing the instances you > get given. Not that that's necessarily expedient, and of course you > might be doing something that's a long way from "normal" -- but maybe > the protocol you're using upstream is wrong? > No! The problem is CLOS, aka the object model. It says we can only store predined information about an instance and must store that information for all instances of that class. Not The Lisp Way. The prototype model is one way out of that trap, but RDF is emerging standard for such things. kt -- http://www.stuckonalgebra.com "The best Algebra tutorial program I have seen... in a class by itself." Macworld
From: Robert Swindells on 29 Jun 2010 06:49 On Tue, 29 Jun 2010 11:46:12 +0200, Pascal Costanza wrote: > It should be relatively easy for a GUI-based tool to construct defclass > forms from user input, right? I have a copy of a paper that describes the LeLisp version of the interface builder and saw Jean-Marie Hullot give a presentation and demo of ExperInterfaceBuilder. My reading of the paper is that most of the Editors were operating on instances of pre-defined classes, not defining new classes, I think it would require a reading of the documentation on the object system used (Alcyone) to be sure though. Robert Swindells
From: Pascal Costanza on 29 Jun 2010 07:28 On 29/06/2010 12:49, Robert Swindells wrote: > On Tue, 29 Jun 2010 11:46:12 +0200, Pascal Costanza wrote: > >> It should be relatively easy for a GUI-based tool to construct defclass >> forms from user input, right? > > I have a copy of a paper that describes the LeLisp version of the interface > builder and saw Jean-Marie Hullot give a presentation and demo of > ExperInterfaceBuilder. > > My reading of the paper is that most of the Editors were operating on > instances of pre-defined classes, not defining new classes, I think it > would require a reading of the documentation on the object system used > (Alcyone) to be sure though. Do you have a reference? Pascal -- My website: http://p-cos.net Common Lisp Document Repository: http://cdr.eurolisp.org Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: joswig on 29 Jun 2010 07:33 On 29 Jun., 12:49, Robert Swindells <r...(a)fdy2.demon.co.uk> wrote: > On Tue, 29 Jun 2010 11:46:12 +0200, Pascal Costanza wrote: > > It should be relatively easy for a GUI-based tool to construct defclass > > forms from user input, right? > > I have a copy of a paper that describes the LeLisp version of the interface > builder and saw Jean-Marie Hullot give a presentation and demo of > ExperInterfaceBuilder. > > My reading of the paper is that most of the Editors were operating on > instances of pre-defined classes, not defining new classes, I think it > would require a reading of the documentation on the object system used > (Alcyone) to be sure though. > > Robert Swindells In the current Interface Builder one can set the class for an object and also create 'runtime' properties. But that is also for a more static setting. If one uses a Lisp-based interface builder, we can edit the running interface objects. Like in the interface Builder for KEE, where you could edit everything via dialogs and menus. The created objects/classes (the so-called knowledge base) are dumped in some external format and can be reloaded - source code of those is not edited as text (though UIs can be programmed where necessary). See here for some KEE in 'action' on my MacIvory 3: http://www.cl-http.org:8002/mov/lispm-kee.mov In the video I gave an example how to: * create objects and classes with a text-based dialog * change the inheritance via menus * add graphical displays to slots * add values to slots adding a slot would be done via the context-menu 'Create slot' on an object ('UNIT'). In Coral Lisp, one had also a prototype object system, and adding a slot to an object is just telling the object to HAVE a slot. There would put some generic window object on the screen and add objects/slots/methods to it one by one. This would also be possible with a CLOS based UI toolkit, but from a UI designer point of view, one would need deal with classes a bit, which was not necessary in Coral Lisp, where I could add slots to objects and/or inherit from other objects. This leads to a slightly more fluid incremental workflow.
From: joswig on 29 Jun 2010 07:34
On 29 Jun., 13:28, Pascal Costanza <p...(a)p-cos.net> wrote: > On 29/06/2010 12:49, Robert Swindells wrote: > > > On Tue, 29 Jun 2010 11:46:12 +0200, Pascal Costanza wrote: > > >> It should be relatively easy for a GUI-based tool to construct defclass > >> forms from user input, right? > > > I have a copy of a paper that describes the LeLisp version of the interface > > builder and saw Jean-Marie Hullot give a presentation and demo of > > ExperInterfaceBuilder. > > > My reading of the paper is that most of the Editors were operating on > > instances of pre-defined classes, not defining new classes, I think it > > would require a reading of the documentation on the object system used > > (Alcyone) to be sure though. > > Do you have a reference? There is a bit of Alcyone here, but not in depth: http://hal.archives-ouvertes.fr/docs/00/07/00/98/PDF/RT-0060.pdf > > Pascal > > -- > My website:http://p-cos.net > Common Lisp Document Repository:http://cdr.eurolisp.org > Closer to MOP & ContextL:http://common-lisp.net/project/closer/ |