[racket] Transparent Structures in 4.2.1

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Sat Jun 5 07:01:42 EDT 2010

Hello all,

I am generating code for a unit, which is later then loaded and
evaluated. My current approach is to convert all structures into a
'personally designed' sexpr and then when loaded, the unit converts the
sexpr back into structures.

I have the feeling that there is currently a better way to do this. I
want basically to automatically serialise my structures and have the
unit deserialise them. This would simplify greatly my software by
removing my hand-coded serialisation implementation.

I thought transparent structures were what I was looking for but after
trying the following maybe they are not:
,----
| #lang scheme
| 
| (define-struct xpto
|   (x y)
|   #:transparent)
`----

,----
| > (define x (make-xpto 1 2))
| > x
| #(struct:xpto 1 2)
| > (define y #(struct:xpto 1 2))
| > x
| #(struct:xpto 1 2)
| > y
| #(struct:xpto 1 2)
| > (xpto-x x)
| 1
| > (xpto-x y)
| . . xpto-x: expects argument of type <struct:xpto>; given #(struct:xpto
| 1 2)
`----

So, what's the actual difference here? And how can I obtain the
automatic serialisation/deserialisation that I need? 

Cheers,

-- 
PMatos
_________________________________________________
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Posted on the users mailing list.