Stream: Ltac2

Topic: non_exhaustive


view this post on Zulip Gaëtan Gilbert (Dec 05 2023 at 13:36):

Would something like this be useful for ltac2? https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute

view this post on Zulip Janno (Dec 05 2023 at 13:43):

I think that's a very, very useful tool to have but I am not sure how the idea of a rust crate would be mapped to Ltac2. The crucial point is that the defining crate itself doesn't have to add _ cases. If that cannot easily be recreated in Ltac2 I don't see a benefit over making the enum extensible to begin with.

view this post on Zulip Pierre-Marie Pédrot (Dec 05 2023 at 14:19):

I don't think that the crucial point is about the defining crate, it's just a QoL syntax. It's not critical to have to handle unknown cases even in the scope where you have control over the type, at worst you lose a little bit of safety. The interest is to force the users to have this default check.

view this post on Zulip Michael Soegtrop (Dec 05 2023 at 14:33):

I can imagine that this would be useful to write user extensible tactics, e.g. in Princeton VST. In some cases one would have to extend some enum or record data types for such extensions.

view this post on Zulip Janno (Dec 05 2023 at 14:38):

But extensible enums already force users to handle the default case, don't they? What's the difference to non_exhaustive without the QoL feature of skipping the default case in the defining crate/module?

view this post on Zulip Gaëtan Gilbert (Dec 05 2023 at 14:39):

extensible enums can be extended by users too

view this post on Zulip Pierre-Marie Pédrot (Dec 05 2023 at 14:39):

There are also non-exhaustive structs.

view this post on Zulip Janno (Dec 05 2023 at 14:41):

Those are good points. I understand now.

view this post on Zulip Michael Soegtrop (Dec 05 2023 at 17:13):

Gaëtan Gilbert said:

extensible enums can be extended by users too

Yes, it is possible with Ltac2 as is. As far as I understand the suggestion, it would make it safer / easier to maintain user extensible tactics.


Last updated: Oct 12 2024 at 12:01 UTC