-
Notifications
You must be signed in to change notification settings - Fork 271
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
Access the predicate of a SubSet type directly #1680
Comments
We can definitely detect if the constraint of a subset type is compilable or not, actually, we are working on that in #1604 |
FWIW, I hoped that |
The reason it would be nice for Dafny to offer this sugar That is, I can evolve a named predicate, Given: predicate Foo?(b: Bar) {
&& Important(b)
&& Things(b)
&& AboutBar(b)
}
type Foo = b: Bar
| Foo?(b) && Woops(b)
witness * The error should clearly be at the // Lots of code
var b := GetMeABar();
// More logic
assert Foo?(b);
// Doing things
OnlyTakeFoo(b); |
I get your point now, for maintainability. It makes better sense. I like both syntaxes Either way, we could start with one and define the other with it. For example, if |
I find SubSet types to be very useful.
However it can be very useful to have access to the predicate that defines the Subset Type.
Like this:
For the most part this works nicely,
but for either very simple Subset Types or very important ones
it would be nice to have a single source of truth.
Dafny already has some simple sugar for
datatype
I would like to see something similar for Subset types
The obvious question: Can the be used at runtime?
I say no, unless someone wants to contemplate
type method Foo...
.Which is so ridiculous that it makes me chuckle :)
I don't think that Subset Types are ever... "compiled"
so I would not complicate things by adding some halfsies condition.
The text was updated successfully, but these errors were encountered: