Deserialization appears to be broken for class-based objects that implement
interfaces with contracted methods.

Given this example module:

#lang racket
(require racket/class
         racket/serialize)
(define foo<%>
  (interface ()
    [foo-method (->m any/c)]))
(define-serializable-class* foo% object% (foo<%>)
  (inspect #f)
  (init-field [v #hasheq()])
  (define/public (foo-method)
    'result)
  (super-new))
(define inst
  (new foo%))


deserialize appears to produce a different type of object than the original:

>  inst
(wrapper-object:foo% '#hasheq())
>  (deserialize (serialize inst))
(object:foo% '#hasheq())
>  (equal? inst (deserialize (serialize inst)))
#f


Also, foo-method does not work on deserialized instances:

>  (send inst foo-method)
'result
>  (send (deserialize (serialize inst)) foo-method)
application: not a procedure;
 expected a procedure that can be applied to arguments
  given: '(#<procedure:foo-method method in foo%> ((#<chaperone-contract:
(->m any/c)> (interface foo<%>) (class foo%) #f)))
  arguments...:

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to