liquidev / rkgk

(repository moved) Multiplayer canvas tool with programmable brushes!
1 stars 1 forks source link

Emit error (or warning?) on ambiguous precedence #85

Open liquidev opened 2 months ago

liquidev commented 2 months ago

A friend shared this example, where haku will misinterpret your intentions because parsers are dumb:

s #000000 x+0 y+1

Here my friend meant to pass x+0 and y+1 as arguments, but haku will interpret the expression as

(s #000000 x) + (0 y) + 1

Which is not at all what he wanted.

I'm not quite sure whether this should be an error or a warning; I'd lean towards always erroring in case function call infix is mixed with operator infix, because it can be really confusing, but arguably it shouldn't prevent compilation.

Emitting a non compilation-failing warning is definitely going to be more work, since right now we expect all diagnostics to be fatal.