Sat 05 Jul 2014 06:16:13 PM UTC, original submission:
This code:
#| begin test.scm contents |#
(define-macro (increment! var delta)
(let ((loc (gentemp))) `(let ((,loc (location ,var))) (set! (,loc) (+ (,loc) ,delta))))
)
(define-simple-class accumulator ()
(value::double 0)
;if the next line is uncommented, and the line after that commented, the example works as expected
;((accumulate delta::double) (increment! (field (this) "value") delta))
((accumulate delta::double) (increment! value delta))
)
(define x (accumulator))
(x:accumulate .5)
(display x:value) (newline)
#| end test.scm contents |#
when compiled and run as "java kawa.repl --main -C test.scm && java test" gives the following output:
-----
(compiling test.scm to test)
java.lang.VerifyError: (class: accumulator, method: $finit$ signature: ()V) Incompatible object argument for function call
at test.run(test.scm:5)
at gnu.expr.ModuleBody.runAsMain(ModuleBody.java:152)
at test.main(test.scm)
-----
Explicitly accessing the field, as in the commented line, works correctly.
This happens both with the binary distribution kawa-1.14.jar, and with a copy built from SVN revision 7945.
----------
In response to the "Did you check to see if this item has already been submitted?" prompt: Bug #14640 looks like it has a similar triggering condition (usage of location to achieve single-evaluation in the spirit of CL's get-setf-expansion), but different output.
|