Skip to content

Compile with errors - #36

Merged
uncomputable merged 6 commits into
BlockstreamResearch:masterfrom
uncomputable:compile-errors
May 14, 2024
Merged

Compile with errors#36
uncomputable merged 6 commits into
BlockstreamResearch:masterfrom
uncomputable:compile-errors

Conversation

@uncomputable

Copy link
Copy Markdown
Collaborator

Extend #34 to include compile errors.

Rewrite the get method in a functional style to make it more readable.
Replay pretty compile errors to the user.
Handle arrays / list expressions in the next commit and introduce
temporary unwraps. These are the only unwraps introduced by this commit.

During the translation from Simfony to Simplicity, the only errors we
should get are from the comp and case combinator.

assert{l,r} cannot fail because there is only one branch. The upstream
methods return Result, which is wrong. I will push a fixup to upstream.

pair should never fail because during the translation of Simfony to
Simplicity, the source type is variable. This is hard to prove, however,
so I chose to handle potential pair unification errors. In a future PR,
I hope to write a proof and remove all these nonexistent error paths.
Arrays and lists are nasty:
The compiler constructs a lot of products which should never fail to
unify... but I cannot convincingly prove it, so I must handle every
single pair as potentially failing... In the end, I fold over tree of
Result<ProgNode, _> instead of trees of ProgNode. This blows up the
compiler code; sorry. I think it is still readable, but we should work
on those infalliable pairs :)
@uncomputable
uncomputable requested a review from apoelstra May 13, 2024 22:41

@apoelstra apoelstra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 42e2738

@uncomputable

Copy link
Copy Markdown
Collaborator Author

Two PRs in a row with instant ACK :o I feel the same way when I write Rust code and it instantly compiles without warnings. Happy and surprised.

@uncomputable
uncomputable merged commit 6f92b74 into BlockstreamResearch:master May 14, 2024
@uncomputable
uncomputable deleted the compile-errors branch May 14, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants