[plt-scheme] cannot serialize classes with private methods

From: Jon Rafkind (workmin at ccs.neu.edu)
Date: Sat Aug 5 20:34:05 EDT 2006

Im trying to use serialization but cant seem to serialize a class that
has a method defined not using public. The following code results in
this error:

serialize: expects argument of type <serializable object>; given
#<procedure:...kazzmir/tmp/x.ss:7:3>

(require (lib "class.ss")
     (lib "serialize.ss"))

(define-serializable-class foo object%
   (public blah)
   (define (blah) (printf "blah\n"))
   (define (foo) (printf "foo\n"))
   (super-new))

(serialize (new foo))

But if foo is defined as public: (public blah foo) then it works fine. I
didnt see anything in the manual that said this would work, what am I
missing?


Posted on the users mailing list.