Hacker News new | ask | show | jobs
by gbear0 1891 days ago
The other ambiguity that I questioned right away was whether the language itself guarantees the order or evaluation or if it's compiler dependent? If I switch between Chrome & Firefox would I get different results?

Also, by using non const expressions in case statements you lose the ability to have a large number of cases get mapped into a jump table. Although, I don't even know if more modern languages even support this optimization anymore since I think supporting non const case expressions is becoming the norm in a lot of languages.

1 comments

JS is specced up the wazoo, including the exact execution semantics. It's fairly difficult to write JS that executes differently between Chrome & Firefox. The only things with intentional nondeterminism in the core language are WeakRef and FinalizationRegistry. And those won't just behave differently between browsers, they may behave differently across browser versions, loads, user activity, etc.

Date parsing has different edge cases between browsers.

The DOM obviously provides more nondeterminism as well as deterministically different behavior, and there are some different things exposed to web pages so it's not like you can't detect which engine you're running on. But things like exact switch case execution ordering are well-covered by the spec.