This is the mail archive of the kawa@sourceware.cygnus.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: trying to migrate to 1.6.60


[ 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/
 > 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]