[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: init-method in PCL
- To: burdorf@RAND-UNIX.ARPA
- Subject: Re: init-method in PCL
- From: kanderso@WILMA.BBN.COM
- Date: Fri, 27 May 88 11:07:59 -0400
- Cc: CommonLoops.pa@Xerox.COM
- In-reply-to: Your message of Wed, 11 May 88 15:17:28 -0700. <8805112217.AA29660@rand.org>
- Redistributed: CommonLoops.pa
Return-Path: <burdorf@rand-unix.ARPA>
Redistributed: CommonLoops.pa
Received: from rand.org (RAND-UNIX.ARPA) by Xerox.COM ; 11 MAY 88 15:35:06 PDT
Received: by rand.org; Wed, 11 May 88 15:17:34 PDT
Message-Id: <8805112217.AA29660@rand.org>
To: CommonLoops.pa@xerox.com
Cc: burdorf@RAND-UNIX.ARPA
Subject: init-method in PCL
Date: Wed, 11 May 88 15:17:28 PDT
From: burdorf@RAND-UNIX.ARPA
Can anyone tell me how to do an "init-method" in PCL so that it works
like init-method does in FLAVORS. I tried fiddling with the
initialize-instance method but didn't get any good results.
thanks
chris burdorf
We use something like this. You can use either the PCL way of
specializing initialize-instance, or the old Flavors way of :INIT
:AFTER methods, or something like the new Flavors way using
MAKE-INSTANCE :AFTER.
(defclass vanilla () ())
(defmethod MAKE-INSTANCE ((class symbol) &rest init-options)
(apply #'make-instance (symbol-class class) init-options))
(defmethod MAKE-INSTANCE ((class standard-class) &rest init-options)
(let ((instance (apply #'pcl:mki class init-options)))
(apply #'make-instance instance init-options)
(:init instance init-options)
instance))
(defmethod MAKE-INSTANCE ((instance vanilla) &rest init-options)
(declare (ignore init-options))
instance)
(defmethod VANILLA :INIT (init-options)
(declare (ignore init-options))
nil)