@mflatt should target-independent compiled code be deterministic, or just “deterministic modulo hash traversal order”?
It’s meant to be deterministic – but I’m sure it’s not yet due to hash-traversal order for linklet bundles, at least.
It’s at least pretty close between racket and pycket, but things seemed to be in somewhat different orders
On that note, are these immutable hashes? And, if so, any ideas on how to give collision nodes a canonical order?
I seem to recall the hamt code in c doing something about this, but I don’t recall what (if I ever knew)
Yes, but I don’t think giving collision node an order is sufficient, since for example symbol hashing might not be the same on every platform/run/etc
Oh right
I think the options are (1) sorting after the fact, which is what we usually do, or (2) an ordered tree by insertion order (as in the ddict pkg) plus ensuring determinisim in insertion
The partly-in-place solution is (1). Specifically, racket/fasl
calls hash-for-each
and hash-map
with #t
for the “try order?” argument, but “try order?” is best-effort and currently not good enough. I think the right thing is probably to strengthen the guarantees of “try order?“.