serializable-struct, etc.: export deserialization info in submodule

This change is slightly incompatible, because `serializable-struct`,
`define-serializable-struct`, and `define-serializable-class` no
longer `provide` and identifier that they used to. Instead, the identifier
is provided by a `deserialize-info` submodule.

The deserializer looks for a `deserialize-info` submodule, and then
falls back to using a module if the submodule is not available.

original commit: 90142edc5b4649e058ccf66970c119076ac5e864
This commit is contained in:
Matthew Flatt 2013-11-08 15:44:26 -07:00
parent fa2a6cb629
commit 0bb7f6eeaa

View File

@ -1,7 +1,8 @@
(module serialize mzscheme
(require-for-syntax syntax/struct)
(require ;; core [de]serializer:
racket/private/serialize)
racket/private/serialize
(only racket/base module+))
(provide define-serializable-struct
define-serializable-struct/versions
@ -361,7 +362,7 @@
#`(begin
(define deserializer-id (make-deserialize-info #,(cadr other-version)
#,(caddr other-version)))
#,@(make-deserialize-provide stx #'deserializer-id))))
#,@(make-deserialize-provide stx #'deserializer-id))))
(define (make-deserialize-name id version-num)
(datum->syntax-object
@ -379,9 +380,10 @@
(list (quasisyntax/loc stx
(namespace-set-variable-value! '#,deserializer-id-stx
#,deserializer-id-stx )))
;; In a module; provide:
;; In a module; provide via submodule:
(list (quasisyntax/loc stx
(provide #,deserializer-id-stx)))))
(module+ deserialize-info
(provide #,deserializer-id-stx))))))
;; ------------------------------
;; The transformers