hi everyone:
I am new in Lisp programming and want to find its compiler or
interpreter of DOS version. There are a lot of file in FTP but I can't
find what the really compiler is.
What's its filename or where can I get the Common Lisp?
thanks a lot.
Mac
------------------------------------------------------------------
�4�(Huang Cheng-Chu; Mac Huang)
Information System Department of Tatung Institution of Technology
···············@pc2.hinet.net
Hi everyone:
I try to customize make-instance in CLOS.
I would like to add :after method and reference the address that is given back by the make-instance call. I am stuck now.
Could somebody help me how to do it, please.
Thanks: Gyula
Roman Gyula (·····@mmt.bme.hu) wrote:
: Hi everyone:
: I try to customize make-instance in CLOS.
: I would like to add :after method and reference the address that is given back by the make-instance call. I am stuck now.
: Could somebody help me how to do it, please.
Hi,
may be you should not specialize make-instance, but rather
initialize-instance. initialize-instance gets called after
the instance has been created.
Example:
(defmethod initialize-instance :after ((instance my-class) &rest initargs)
; do what ever you want with instance
; For example store a reference to the instance somewhere else
(setf *last-instance-created* instance))
For a detailed discussion see Steele, G.L., Jr. (1990). Common Lisp.
The Language. Digital Press, p. 807.
You're welcome
Kai
_____________________________________________________________________________
Kai Zimmermann FB Informatik WSV, University of Hamburg, Vogt-Koelln-Str. 30
D-22527 Hamburg, Germany, Phone +49-40-54715-368, Fax -385
········@informatik.uni-hamburg.de
In article <··········@goliat.eik.bme.hu>, ·····@mmt.bme.hu (Roman Gyula) writes:
>
>Hi everyone:
>
>I try to customize make-instance in CLOS.
>I would like to add :after method and reference the address that is given back by the make-instance call. I am stuck now.
>Could somebody help me how to do it, please.
>
>Thanks: Gyula
>
I believe what you want to do is write an :AFTER method for
INITIALIZE-INSTANCE. The syntax is as below. The first argument is the
object being instantiated, and must be of the type of the class for
which you want to modify MAKE-INSTANCE. The other arguments that are
passed to INITIALIZE-INSTANCE are the default initargs that are
defined for the class in question.
>(defclass foo () ()) ; A dummy class
#<Standard-Class FOO>
>(defmethod initialize-instance :after ((bar foo) &rest args)
(format t " Creating instance of class FOO: ~A
With initargs: ~S" bar args))
> #<Init-Method INITIALIZE-INSTANCE :AFTER (FOO)>
> (make-instance 'foo)
Creating instance of class FOO: #<Foo #XEB3866>
With initargs: NIL
#<Foo #XEB3866>
>
Hope this helps.
Rama Lakshmanan
From: Peter Bengtson
Subject: Re: Customizing make-instance
Date:
Message-ID: <30F54C3D.13A3@fst.se>
Without any more detailed description of what you are trying to
achieve, it's difficult to help you, but the usual way of
manipulating the newly created object is through INITIALIZE-INSTANCE
which is called by MAKE-INSTANCE as a part of the process of
creating an instance. INITIALIZE-INSTANCE is a generic function,
which means you can add an :AFTER method.
If you're unfamiliar with INITIALIZE-INSTANCE, have a look in
Steele.
Of course, if you are actually trying to replace the object creation
protocol, you do need to define a method on MAKE-INSTANCE. This
involves the meta-object protocol and is fairly advanced stuff.
Peter Bewngtson