feat: add infix operators and warnings#232
Draft
stringhandler wants to merge 1 commit intoBlockstreamResearch:masterfrom
Draft
feat: add infix operators and warnings#232stringhandler wants to merge 1 commit intoBlockstreamResearch:masterfrom
stringhandler wants to merge 1 commit intoBlockstreamResearch:masterfrom
Conversation
gerau
reviewed
Mar 12, 2026
Contributor
There was a problem hiding this comment.
Not sure if this would be better, but you can put warnings into Scope struct, and collect them from scope.destruct(). I tried similar approach, but with errors in #217.
82e25d8 to
1c5db60
Compare
a819f70 to
670b940
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Looking mainly for a Concept ACK here. I've added two big changes here. The first is to add infix operators, the second is to add warnings. I'm happy to try separate into two PRs, with the warnings standalone. I feel like without this context, the warnings don't really make sense.
The problem with using infix operators instead of jets is that the jets return
carryandborrowbools for over/underflow. To try address this, the actual injected simplicity code (for examplelet c:u8 = a+b;) is basically equivalent to:So if it would overflow the program will fail.
To alert the developer of this possibly unintended side-effect, I've added the idea of warnings. The program still compiles, but alerts the developer to add checks.
Additional warning were also added for division, which also injects code to panic on divide by 0.
A small addition is also to mark
errorsin red andwarningsin yellow.Warnings look like below (note the program is still ouputed:
Example
See
examples/infix_operators.simffor a full demonstration of all operators.