samth
2022-5-13 19:43:36

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


john
2022-5-13 22:50:14

@john has joined the channel


dan.ml.901
2022-5-14 00:09:09

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))) )


sorawee
2022-5-14 00:11:03

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


sorawee
2022-5-14 00:11:25

(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)


dan.ml.901
2022-5-14 00:12:16

Why is that first 2 in there?


dan.ml.901
2022-5-14 00:12:28

the prefab type is (s1 s0 2)?


sorawee
2022-5-14 00:14:05

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


sorawee
2022-5-14 00:15:17

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)


sorawee
2022-5-14 00:16:00

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


dan.ml.901
2022-5-14 00:19:29

I see… interesting


dan.ml.901
2022-5-14 00:19:32

thanks!


notjack
2022-5-14 02:18:03

“you know what our serialization format needs? inheritance”


wjb
2022-5-14 04:45:52

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