[racket] Typed racket with serializable struct

From: antoine (antoine597 at gmail.com)
Date: Fri Sep 6 16:17:51 EDT 2013

Hello,

I would like to use a 'serialize-struct' in typed/racket.  It seems 
there is no
'serialize-struct:' built in typed/racket.

So i have decided to put the struct into a specific submodule and 
require/type
the structs.

;;----test.rkt----
#lang typed/racket

(module data-structs racket
   (require racket/serialize)

   (serializable-struct ArrayType (expr) #:transparent)

(provide struct:ArrayType ArrayType? ArrayType ArrayType-expr))

(require/typed 'data-structs
           [#:struct ArrayType
             ([expr : Integer])])
;;----test.rkt----

I get this errors which i can't understand:

link: module mismatch;
  possibly, bytecode file needs re-compile because dependencies changed
   importing module: 'phpdoc-struct
   exporting module: 'phpdoc-struct
   exporting phase level: 0
   internal explanation: variable not provided (directly or indirectly)
   at: ArrayType2
   in: ArrayType.17

Note that if i use two file it works.
Note if i use (provide (struct-out ArrayType)) i get the following error:

phpdoc-struct.rkt:6:23: module: provided identifier not defined or 
imported for phase 0
   at: ArrayType
   in: (#%module-begin (#%require racket/serialize) (define-values 
(struct:ArrayType ArrayType1 ArrayType? ArrayType-expr) (let-values 
(((struct: make- ? -ref -set!) (letrec-syntaxes+values 
(((struct-field-index12) (convert-renamer (lambda (stx) (syntax-case s...

I have no idea of what happen?


Posted on the users mailing list.