r/ProgrammingLanguages • u/jamiiecb • Apr 10 '26
Borrow-checking surprises
https://www.scattered-thoughts.net/writing/borrow-checking-surprises
52
Upvotes
r/ProgrammingLanguages • u/jamiiecb • Apr 10 '26
View all comments
Show parent comment
3
u/ExplodingStrawHat Apr 11 '26
Why does it break? Wouldn't the chained methods desugar to
baz(bar(foo, a()), b())? If arguments are evaluated from right to left then this would evaluateb()first, thena(), thenfoo, thenbar(...), thenbaz(...). Is this not what one would expect?