Open GoogleCodeExporter opened 9 years ago
Thank you for your suggestion!
I will think about how to implement it.
-- fujita
Original comment by y.fujita...@gmail.com
on 6 May 2009 at 2:33
I have implemented closure serialization in revision 484. (experimental)
Your comments are very welcome. Thank you!
-- fujita
======
The closures they only reference top level variables and its local variables are
serializable.
> (import (ypsilon concurrent))
> (define mbox-req (make-mailbox))
> (define mbox-ans (make-mailbox))
> (spawn (lambda () (let ((proc (recv mbox-req))) (proc "hello world"))))
1
> (send mbox-req
(lambda (m1)
(let ((m2 (string-upcase m1))
(m3 (string-titlecase m1)))
(send mbox-ans (list m2 m3))))
100)
#t
> (recv mbox-ans 100)
("HELLO WORLD" "Hello World")
====
The closures they reference any free non-global variable(*1) are not
serializable.
> (import (ypsilon concurrent))
> (define mbox-req (make-mailbox))
> (spawn (lambda () (let ((proc (recv mbox-req))) (proc "hello world"))))
1
> (let ((mbox-ans (make-mailbox))) ;; mbox-ans(*1)
(send mbox-req
(lambda (m1)
(let ((m2 (string-upcase m1))
(m3 (string-titlecase m1)))
(send mbox-ans (list m2 m3)))) ;; mbox-ans(*1)
100))
error in shared-queue-push!: encountered non-serializable object, #<closure
0x776e1370> may have reference to free non-global variable
irritants:
(#<shared-queue 0/1 0x77752000> #<closure 0x77753980> 100)
Original comment by y.fujita...@gmail.com
on 30 May 2009 at 3:44
Original issue reported on code.google.com by
sura...@gmail.com
on 2 May 2009 at 2:25