This is the mail archive of the kawa@sourceware.org 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]
Other format: [Raw text]

RE: Kawa-1.9.90 available


That is usable, as long as a set-procedure-property! call is used to set
the function name.  Following is an example which can be used to update
the documentation:
#|kawa:28|# (define y (lambda (a) (display a) (newline) (force-output)
2))
#|kawa:29|# (set-procedure-property! y 'name 'y)
#|kawa:30|# (trace y)
#|kawa:31|# (y 1)
call to y (1)
1
return from y => 2
2
#|kawa:32|#
Otherwise the procedure name appears as "??".

Dan Stanger
Eaton Vance Management
Two International Place 
Boston, MA 02110
Mobile: 617 646 9682
Office: 617 672 8261

-----Original Message-----
From: Per Bothner [mailto:per@bothner.com] 
Sent: Monday, August 10, 2009 2:28 PM
To: Dan Stanger
Cc: kawa@sourceware.org
Subject: Re: Kawa-1.9.90 available

On 08/10/2009 11:16 AM, Dan Stanger wrote:
> On 5/27 I sent out:
>
>> Hello All,
>> The following expressions produce a trace in 1.9.1:
>> #|kawa:1|# (define (x a) (display a))
>> #|kawa:2|# (trace x)
>> #|kawa:3|# (x 1)
>> call to x (1)
>> return from x =>
>> 1
>> #|kawa:4|#
>> However the same expressions using the current svn do not:
>> #|kawa:1|# (define (x a) (display a))
>> #|kawa:2|# (trace x)
>> #|kawa:3|# (x 1)
>> 1
>> #|kawa:4|#
>> Is there a configure switch to enable tracing?
>> This is compiled with JDK 1.6.0.

Trace is awkward - it is a run-time function, so it can't
modify static/lexical bindings - and Kawa is all about
doing as much at compile-time as we can.

There is a --no-inline flag which probably should do what
you want - but doesn't.  That would perhaps be looked into.

However, there is one relatively simple work-around
that works - use the variable-definition syntax for
of define, rather than the function-definition form:

(define x (lambda (a) (display a)))

Kawa treats these forms differently - the syntax
(define (x a) (display a)) has the extra effect of
declaring x to be constant, which means calls to x
may be bound/optimized so the trace doesn't work.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/


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