This repository was archived by the owner on Nov 26, 2025. It is now read-only.
"pure" and "error" special forms - #367
Merged
Merged
Conversation
rsoeldner
approved these changes
May 2, 2025
jmcardon
force-pushed
the
jose/error-special
branch
from
May 12, 2025 18:12
63c0aa5 to
babe71f
Compare
6 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
cc @CryptoPascal31
Supersedes #273 (Saves me a rebase).
Implements KIP 0024.
This PR adds two special forms into pact.
pure
(pure k)for some expressionkwill evaluatekin read-only mode. That is, the evaluation ofkcannot write to the database, only read.Example here
typing rule
Other notes
purehas been a community ask for a while, and allows users to use the power oftrybut without forcing users to write `(try (enforce false "boom") something)error
(error foo)for some string valued expressionfoo(e.g"hello"or(format "{}" ["bar"])) will throw a recoverable error (so catchable with try).Example here
typing rule
For some fresh
αerrorin pact is essentially ⊥-elimination for pact. This is particularly useful for typechecking expressions where(enforce falsewill not suffice, as the return type of that isbool.PR checklist:
Additionally, please justify why you should or should not do the following: