This is the mail archive of the
kawa@sourceware.cygnus.com
mailing list for the Kawa project.
Re: trying to migrate to 1.6.60
- To: Per Bothner <per at bothner dot com>
- Subject: Re: trying to migrate to 1.6.60
- From: "Walter C. Pelissero" <wcp at demon dot db dot de>
- Date: Tue, 5 Oct 1999 10:31:17 +0200 (W. Europe Daylight Time)
- Cc: kawa at sourceware dot cygnus dot com
- References: <14327.53727.32000.993914@demon.db.de><m27ll3engd.fsf@magnus.bothner.com><14328.30025.687000.592629@demon.db.de><m2emfbccbt.fsf@magnus.bothner.com>
- Reply-To: wcp at pop dot systemy dot it
[ I CC-ed to the mailing list because I belive it might be of public
interest. ]
I tried to extend a little bit your sample code but for instance this
doesn't work:
(define-syntax trace-variable
(syntax-rules ()
((trace-variable var)
(%trace-variable (location var)))))
(define (%trace-variable loc)
((primitive-virtual-method <gnu.mapping.Binding> "setConstraint"
<void> (<gnu.mapping.Constraint>))
loc (object (<gnu.mapping.Constraint>)
((get (binding <gnu.mapping.Binding>))
(display "get method")
(newline)
((primitive-get-field <gnu.mapping.Binding> "value" <object>)
binding))
((set (binding <gnu.mapping.Binding>)
(value <object>))
(display "set method")
(newline)
((primitive-set-field <gnu.mapping.Binding> "value"
<object>)
binding value))
((isBound (binding <gnu.mapping.Binding>))
(display "isBound method")
(newline)
#t))))
unless you declare value public (inside Binding class).
I guess I'm missing something.
Per Bothner writes:
> "Walter C. Pelissero" <wcp@demon.db.de> writes:
>
> > Unfortunately I based a poor-men tracing package on this. The new
> > Kawa, as far as I know, doesn't offer anything even close to it.
>
> let-syntax may be useful, as it allows you to define a macro (perhaps
> named set!) while still having access to the old definition. However,
> it only does this syntactically in a local scope.
>
> If you want to trace a / some variables, then I think a better
> approach is to use the Binding / Constraint framework in gnu.mapping.
> It should be possible to define a Syntax
> (trace-variable var)
> which replaces the `constraint' field of the variable `var' with a
> Constraint that has the side-effect of printing out trace information.
> I would try:
> (define-syntax trace-variable (syntax-rules ()
> ((trace-variable var)
> (%trace-variable (location var)))))
> (define (%trace-variable loc)
> ((primitive-virtual-method <gnu.mapping.Binding> "setConstraint"
> <void> (<gnu.mapping.Constraint>))
> loc (object (<gnu.mapping.Constraint>) ....)))
>
> The .... is up to you.
>
> Let me know if you get this working and useful. May be I'll add
> something like this to standard Kawa.
> --
> --Per Bothner
> bothner@pacbell.net per@bothner.com http://www.bothner.com/~per/
>