
@laurent.orseau this test seems to fail occsaionally: http://drdr.racket-lang.org/60577/racket/share/pkgs/quickscript-test/drracket.rkt

@john has joined the channel

Is the reading of #:prefab
structs that have supertypes not well supported? I have this program but it errors out because it thinks that an s1
is not an s0
: (struct s0 (a b) #:prefab)
(struct s1 s0 (c d) #:prefab)
(for/list ([s (in-list (list "#s(s0 1 2)"
"#s(s1 1 2 3 4)"))])
(s0-a (read (open-input-string s)))
)

#s(s1 1 2 3 4)
is not s1

(struct s0 (a b) #:prefab)
(struct s1 s0 (c d) #:prefab)
(println (s1 1 2 3 4)) ;=> '#s((s1 s0 2) 1 2 3 4)

Why is that first 2
in there?

the prefab type is (s1 s0 2)
?

It encodes the number of fields for supertypes, if I understand correctly

E.g.
(struct s0 (a b) #:prefab)
(struct s1 s0 (c) #:prefab)
(struct s2 s1 (x y z) #:prefab)
(struct s3 s2 () #:prefab)
(s3 1 2 3 5 6 7) ;=> '#s((s3 s2 3 s1 1 s0 2) 1 2 3 5 6 7)

s3
doesn’t require the number of fields, because that’s just all fields subtracted by fields in supertypes.

I see… interesting

thanks!

“you know what our serialization format needs? inheritance”

Do you know why the parent and field numbers are required? This syntax has always annoyed me and seems so unnecessary.