Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Describe the function preconditions in comments/docstrings #1945

Open
hwwhww opened this issue Jun 30, 2020 · 2 comments
Open

Describe the function preconditions in comments/docstrings #1945

hwwhww opened this issue Jun 30, 2020 · 2 comments
Labels
general:presentation Presentation (as opposed to content)

Comments

@hwwhww
Copy link
Contributor

hwwhww commented Jun 30, 2020

Issue

Pointed out by @franck44 and @protolambda, it would be more readable if we can more it clear of what are the preconditions of each function.

How to solve it

Add more detailed comments about the pre-conditions.

/cc @protolambda feel free to update this issue content. :)

@hwwhww hwwhww added the general:presentation Presentation (as opposed to content) label Jun 30, 2020
@ericsson49
Copy link
Contributor

ericsson49 commented Jul 2, 2020

It might be helpful to use Nagini to specify pre- and post-conditions (as well as other useful annotations).
It enriches statically-typed Python3 subset (PEP-484, mypy) with constructs to specify pre-conditions (Requires) and post-conditions (Ensures), exceptional post-conditions (Exsures), as well as invariants, function purity (@Pure), assertions, predicates, etc.

It uses Boogie and Z3 as Dafny, though it's underlying logic is different. However, the idea is to use its extensions to annotate the py-spec with pre-/post-conditions and other useful annotations (like @Pure).

One option can be to design a contract library based on the ideas of the Nagini contract library (e.g. one can express Dafny annotations instead of Viper ones).

@hwwhww hwwhww added this to the 🔵 v1.0.0 Nice-to-have milestone Aug 21, 2020
@hwwhww
Copy link
Contributor Author

hwwhww commented Sep 3, 2020

Took a look Viper and Nagini today. Some quick notes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:presentation Presentation (as opposed to content)
Projects
None yet
Development

No branches or pull requests

4 participants
@hwwhww @ericsson49 and others