Inform 7, of course, knows about the priority of mathematical symbols. It evaluates “6 - 4 / 2” correctly as 6 - (4 / 2) = 4, not as (6 - 4) / 2 = 1.
Well… sometimes.
[code]“Say it with words” by Victor Gijsbers
Mathematical laboratory is a room.
When play begins:
let n be 6 - 4 / 2;
say “Obviously, 6 minus 4 divided by 2 is [n].”;
let m be 6 minus 4 divided by 2;
say “Unless, of course, it is [m].”[/code]
This leads to the unexpected:
Note that the manual (section 14.2) tells us that “the verbal and symbolic forms of these phrases are equivalent”. Do I miss something obvious, or is this a big fat evil bug?
Sure, it’s easily fixed, but this is a likely source of very hard to detect bugs… I just noticed it for one of my calculations, but had not been noticing it for several others that used the same format.
Yes, that’s a bug, and a rather odd one. Of the forms:
let K be 6 minus 4 divided by 2;
let M be 6 - 4 divided by 2;
let N be 6 minus 4 / 2;
let P be 6 - 4 / 2;
…only the last gets correct associativity. Since, as you note, the operations are defined identically, there must be something weird going on with I7’s own parsing.