Re: Useful code - perhaps worth modifying base distribution?
From: Moises Lejter <mlm_at_cs.brown.edu>
Date: Wed, 26 Jul 1995 04:33:41 -0400
To: stk_at_kaolin.unice.fr
Subject: Re: Useful code - perhaps worth modifying base distribution?
References: <199507260554.BAA21228_at_aruba.cs.brown.edu>
Reply-To: mlm_at_cs.brown.edu
X-Mailing-List: <stk_at_kaolin.unice.fr> archive/latest/784
X-Loop: stk_at_kaolin.unice.fr
Precedence: list
So - it turns out the code I just sent will not work, with either
STk-2.1.6 (the one I am still using) or STk-2.2. It will complain
that all locally defined symbols are undefined while creating the
class.
It seems to me it *ought* to work, so I went looking to see what the
problem was. It turns out that the slots specified in a
#'define-class are passed on in the expansion of #'define-class as a
simple quoted list. The environment in which the (define-class ...)
form appeared is thrown away.
What follows is a patch to stklos.stk (which I think works for both
STk-2.1.6 and STk-2.2) that fixes this problem.. With this patch,
#'define-class passes the environment a define-class form appears in
as the :environment option. That information is passed on into the
code that creates the class, and in particular it is used when
evaluating the :slot-ref and :slot-set! options of :virtual slots.
With this patch, the code in my previous message works properly... ;-)
I think a better solution is to modify define-class so that slot defintions
are no longer a simple quoted list, but are computed in the lexical
environment of the macro expansion. This would make the unsightly evals in
compute-get-n-set unnecessary. In fact, now that i look at it, none of the
evals should be necessary.
k
Received on Mon Jul 31 1995 - 16:23:43 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST