Extractable description of assertions #688
Quantumplation
started this conversation in
General
Replies: 1 comment
-
interesting, very cool |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given that
expect
is such a prominent part of the language, it would be pretty cool to extract, as part of the blueprint, a description of the constraints enforced by the smart contract, perhaps using some labels / doc comments; This may be pipedream stuff, but I figured I'd document some of my thinking just in case.i.e. something like:
which produces a checklist in the blueprint:
This idea stems from the way I usually write my smart contracts, which look something like this:
where condition_1 and condition_2 are english statmenets like
token_present_in_output
ordatum_updated_legally
The formatting around long && chains, and the performance implications, means that I'm rewriting my contract as:
and each condition that I'm
expect
ing on isn't always as readable ascondition_1
andcondition_2
; I found myself missing the labels, and wondering since this is the central pillar of what your contract is checking, it might make sense to expose this in the blueprint as a form of documentation for auditors, etc.As a non-aiken related aside (that might provide some inspiration we can bring back), it kind of makes me want to write a smart contract language that is really focused on a sort of natural language description, upfront, of what the contract enforces, with the code that computes each condition secondary, plus some built-in constructs for common patterns (like continuing outputs, etc.)
Some hypothetical syntax for this language
Beta Was this translation helpful? Give feedback.
All reactions