jmid / mutaml

An OCaml mutation tester
BSD 2-Clause "Simplified" License
65 stars 4 forks source link

Fix the evaluation order of arithmetic operands #3

Closed gasche closed 2 years ago

gasche commented 2 years ago

Note: I think that a simpler translation of e1 + e2, which would avoid issues with evaluation order as well, would be

(if <mutate> then (-) else (+)) e1 e2
jmid commented 2 years ago

Thanks - and good points!

I agree that (if <mutate> then (-) else (+)) e1 e2 would be simpler. My immediate reaction was to think "but that will then allocate a closure" - which it probably won't precisely because of the "lets-do-right-to-left-eval-to-save-closure-alloc" ZINC-trick! 😄 I'm wondering whether there would be any performance difference between the two though 🤔

Your implicit suggestions for