samth
2018-11-26 17:50:57

@mflatt should target-independent compiled code be deterministic, or just “deterministic modulo hash traversal order”?


mflatt
2018-11-26 18:01:57

It’s meant to be deterministic – but I’m sure it’s not yet due to hash-traversal order for linklet bundles, at least.


samth
2018-11-26 18:13:18

It’s at least pretty close between racket and pycket, but things seemed to be in somewhat different orders


jaz
2018-11-26 18:15:10

On that note, are these immutable hashes? And, if so, any ideas on how to give collision nodes a canonical order?


jaz
2018-11-26 18:18:12

I seem to recall the hamt code in c doing something about this, but I don’t recall what (if I ever knew)


samth
2018-11-26 18:23:05

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


jaz
2018-11-26 18:23:39

Oh right


samth
2018-11-26 18:25:01

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


mflatt
2018-11-26 21:52:28

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?“.