sva39940.scm 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ;; Savannah bug #39940
  2. ;; "Class member of type <procedure> compilation exception"
  3. (define-simple-class <Simple1> (<Object>)
  4. (callback type: <procedure>)
  5. ((*init*) (set! callback (lambda _ (format #t "Working1~%")))))
  6. ((make <Simple1>):callback)
  7. ;; Output: Working1
  8. ;; Same, but with a private field.
  9. (define-simple-class <Simple1p> (<Object>)
  10. (callback type: <procedure> access: 'private)
  11. ((*init*) (set! callback (lambda _ (format #t "Working1p~%"))))
  12. ((docallback) (callback)))
  13. ((make <Simple1p>):docallback)
  14. ;; Output: Working1p
  15. (define-simple-class <Simple2> (<Object>)
  16. (callback type: <procedure>
  17. init: (lambda _ (format #t "Working2~%")))
  18. ((docallback) (callback)))
  19. ((make <Simple2>):docallback)
  20. ;; Output: Working2
  21. ;; Same, but with a private field.
  22. (define-simple-class <Simple2p> (<Object>)
  23. (callback type: <procedure> access: 'private
  24. init: (lambda _ (format #t "Working2p~%")))
  25. ((docallback) (callback)))
  26. ((make <Simple2p>):docallback)
  27. ;; Output: Working2p
  28. (define (foo)
  29. (let ((f (lambda _ (format #t "Working3~%"))))
  30. (list f f)))
  31. (format #t "~a~%" (car (foo)) ((cadr (foo))))
  32. ;; Output: Working3
  33. ;; Output: #<procedure f>