-
Notifications
You must be signed in to change notification settings - Fork 562
Deprecate and remove inductive
... :=
#5236
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
Comments
Why not enforce the first one and deprecate both def f : Nat → Nat where
| 0 => 42
| (.succ n) => f n |
def foo : Inhabited Nat where
default := 0 |
In the interested of pragmaticm, we should probably stick to “overwhelming majority of declarations use” and keep the one with |
It looks like mathlib uses no- I don't mind going with |
Beware of mathportisms when looking at mathlib code for common style. I just checked and no- |
Deprecates `inductive ... :=`. Also, makes `where` required if there is at least one constructor. Currently produces a warning, controlled by `linter.deprecated`. We don't require `where` when there are no constructors. Closes leanprover#5236
#5533 has a linter for no- Do we want to be strict about |
The |
I don't think it does. But I think the ship sailed long ago on discussing the merits of syntax choices other than by appeal to least disruption. |
@david-christiansen If the |
Note, in lean 3 there was only no- |
I have hard numbers: 79% of inductives in core use Personally, if we have to deprecate two out of three, I would rather deprecate both I'll make another PR that deprecates just |
Deprecates `inductive ... :=` and `structure ... :=`. Currently this syntax produces a warning, controlled by the `linter.deprecated` option. Part of leanprover#5236
Deprecates `inductive ... :=` and `structure ... :=`. Currently this syntax produces a warning, controlled by the `linter.deprecated` option. Part of leanprover#5236
Deprecates `inductive ... :=`, `structure ... :=`, and `class ... :=` in favor of the `... where` variant. Currently this syntax produces a warning, controlled by the `linter.deprecated` option. Breaking change: modifies `Lean.Linter.logLintIf` to use `Lean.Linter.getLinterValue` to determine if a linter value is set. This means that the `linter.all` option now is taken into account when the linter option is not set. Part of #5236
The I don't really want to resolve whether |
I quite dislike When I would rather |
Description
Today, Lean accepts all of the following:
It seems that the overwhelming majority of declarations use the latter syntax (with
where
). In the interest of simplifying things, how about we deprecate the first two?Context
The broad context here is that I'm writing the new reference manual with tooling that can let us know about undocumented tokens. The documentation should be comprehensive and describe what the language does.
Deprecating these two alternate syntaxes, rather than documenting them, would make Lean code more uniform and reduce the language surface area.
I'm not advocating immediate removal - a long deprecation period won't hurt anything - but a warning would be useful.
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: