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

Open
opened 2024-09-04 21:58:03 +02:00 by liquidev · 0 comments
liquidev commented 2024-09-04 21:58:03 +02:00 (Migrated from github.com)

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.

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.
liquidex added this to the Backlog project 2024-09-13 20:24:03 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: liquidex/rkgk#85
No description provided.