[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New CLISP version



Bruno Haible wrote:
> 
> You may call it a bug. I chose this approach to reduce the costs of calling
> MAKE-INSTANCE. For now, it's 1 generic function call and dispatch and 2
> built-in function calls. If MAKE-INSTANCE is required to go through
> INITIALIZE-INSTANCE and SHARED-INITIALIZE, the costs will be at least 3 GF
> calls and about 10 other function calls. Unless I do some ugly hacks,
> modifying #'MAKE-INSTANCE every time a method is added to
> #'INITIALIZE-INSTANCE or #'SHARED-INITIALIZE.
> 
> What is common practice in CLOS programs? Are methods for INITIALIZE-INSTANCE
> frequent or not? What about methods for SHARED-INITIALIZE ?
> 
> 
My experience in CLOS-programming is not very extensive, however many programs,
I saw used INITIALIZE-INSTANCE to do most of the work. I use CLOS (and used 
PCL before) to build a simple window system based on the StdWin interface
of CLISP (which I've finished). 
I think it is very desirable, to be able to do something like

(make-instance 'menu-window 
               :title "Lisps" 
               :items (list "CLISP" "LUCID" "ALLEGRO"))

to create a pop-up-menu. Of course it is possible, to write a wrapping
function MAKE-MENU-WINDOW, that explicitly calls initialize-instance, but
why should this be necessary? CLtL2 (sorry I don't have CLtL1) says on page 847:

"The generic function initialize-instance is called by make-instance to
initialize a newly created instance."

The same can be found in the PCL documentation "Functions in the
Programmer Interface" page 2-57. I think ist's not a good idea to
pay with incompatibilty for sparing a few function calls.
However - that's *my* opinion - of course.

Anyway - after changing MAKE-INSTANCE - everything worked fine. The
performance of the new CLOS is very impressing - compared to PCL.
Pretty good work - thanks!

--Matthias

------------------------------------------------------------------------------
Matthias Lindner
FG Intellektik, FB Informatik
Technische Hochschule Darmstadt
Alexanderstr.10, D-64283 Darmstadt
TEL: +49 6151 166651
FAX: +49 6151 165326
NET: matthias@intellektik.informatik.th-darmstadt.de
------------------------------------------------------------------------------