Hash of enum from module gives inconsistent values run to run

Dicts in Julia don’t have an order; even without hash giving different values run to run, the order is not stable. You can use OrderedCollections if you need a collection with an order.

There is a fallback definition, yes, which ultimately falls back to using objectid, which may give a different result due to the module the enum is in changing run to run.

Also, hashing Base.Enum values is a bit tricky, because under the hood they are primitive types.

1 Like