Closed edwintorok closed 4 years ago
Thanks Edwin. Just to make things clear does that restore the previous format exactly ?
Not exactly, there is an extra space now (I'd consider that an improvement). I don't particularly mind about the exact format (the docs for Dump make it clear that the exact format is unspecified), as long as there is some separator between keys and values, such that it is unambiguous where the key ends and the value starts.
0.8.8: (hashtbl 510 46)
0.8.6: (hashtbl (5, 10)(4, 6))
this PR: (hashtbl (5, 10) (4, 6))
Small testcase:
let () =
let x = Hashtbl.create 5 in
Hashtbl.add x 4 6;
Hashtbl.add x 5 10;
Fmt.pf Fmt.stdout "%a@." (Fmt.Dump.hashtbl Fmt.int Fmt.int) x
Thanks what you propose was what I was going to ask your for. Your patch is in as 1662bb0be5f3d9e443
Fix regression introduced in Fmt.0.8.7, where Dump.hashtbl prints no separators anymore:
Prior to fmt.0.8.7 it used to print separators between keys and values which is more useful:
Move code around, so that we use the definition of
pair
fromDump
, which adds the proper separators.