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

Emit an error when using a law attribute incorrectly #904

Open
jhjourdan opened this issue Oct 28, 2023 · 4 comments
Open

Emit an error when using a law attribute incorrectly #904

jhjourdan opened this issue Oct 28, 2023 · 4 comments

Comments

@jhjourdan
Copy link
Collaborator

jhjourdan commented Oct 28, 2023

#[law] should only be allowed in trait method declarations and when giving an implementation of a law.

@dewert99
Copy link
Collaborator

Could it make sense to allow adding the attribute to non-trait methods (lemmas)? They could be automatically added to the context whenever the type the method is for is brought into scope.

@jhjourdan
Copy link
Collaborator Author

That's another way to solve this issue, indeed.

I agree that we need an auto-load mechanism for lemmas which are not part of traits.

But this poses several questions:

  • What does "a types is brought into scope" means, exactly?
  • Is this really the auto-load mechanism we want? It seems rather weak, I would rather prefer not having to add yet another one if this one is not enough.

@jhjourdan
Copy link
Collaborator Author

Note: laws of traits have a different behavior: they are triggerred by uses of methods of the trait (not of the type). This means that we would have a different bahavior. Is this confusing?

@xldenis
Copy link
Collaborator

xldenis commented Oct 30, 2023

That's another way to solve this issue, indeed.

I agree that we need an auto-load mechanism for lemmas which are not part of traits.

But this poses several questions:

* What does "a types is brought into scope" means, exactly?

* Is this really the auto-load mechanism we want? It seems rather weak, I would rather prefer not having to add yet another one if this one is not enough.

I agree that the question of inherent laws should be addressed in a second piece of work. Ensuring the 'coherence' of declaration types is more important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants