Closed djbe closed 5 years ago
I think it's fine though I don't think this was mentioned anywhere in docs (I mean Stencil) that on dictionaries the order sill be deterministic. But this will preserve current behaviour at least.
I think end users would expect consistent behaviour, no matter what the underlying (Swift) behaviour might be?
And with the new swift hashing, we're forced to do something ourselves in this case.
🤷♂️ depends on user understanding of nature of such types =) for some deterministic order in swift < 4.2 could be a surprise too =)
@ilyapuchka I inadvertently merged this into the wrong branch 🤦♂️, so we should continue our discussion in #242.
⚠️ Note: based on #239, so merge that first!
With Swift 4.2, hashing isn't consistent between runs anymore. A consequence of this is, if we iterate over a dictionary, the output won't always be the same, which will be unexpected for a user.
With this PR we iterate over the sorted keys of a dictionary, ensuring consistent output across runs.