sva42689.scm 600 B

1234567891011121314151617181920
  1. ;; Savannah bug #42689:
  2. ;; Bytecode verify error involving use of "location"
  3. (define-macro (increment! var delta)
  4. (let ((loc (gentemp)))
  5. `(let ((,loc (location ,var))) (set! (,loc) (+ (,loc) ,delta))))
  6. )
  7. (define-simple-class accumulator ()
  8. (value::double 0)
  9. ;if the next line is uncommented, and the line after that commented, the example works as expected
  10. ;((accumulate delta::double) (increment! (field (this) "value") delta))
  11. ((accumulate delta::double) (increment! value delta))
  12. )
  13. (define x (accumulator))
  14. (x:accumulate .5)
  15. (display x:value) (newline)
  16. ;; Output: 0.5