Zulip Chat Archive
Stream: std4
Topic: unused anonymous argument
Patrick Massot (Sep 19 2023 at 19:29):
Is the following linter error expected?
import Std.Tactic.Lint
/-- My foo function. -/
def foo (_ : Nat) := 0
#lint
The underscore makes it clear I want this to be an unused argument.
Mario Carneiro (Sep 19 2023 at 19:32):
It is expected, yes. The mathlib/std unused arguments linter looks at the underlying expression and doesn't care about argument names
Patrick Massot (Sep 19 2023 at 19:35):
Is this considered to be a bug or a feature?
Mario Carneiro (Sep 19 2023 at 19:35):
a behavior :shrug:
James Gallicchio (Sep 19 2023 at 19:35):
(unlike the core unused-arg linter, which fails to catch non-syntactic uses, right?)
Mario Carneiro (Sep 19 2023 at 19:35):
I can see uses for it
Mario Carneiro (Sep 19 2023 at 19:35):
right @James Gallicchio
Mario Carneiro (Sep 19 2023 at 19:36):
for instance you can use def foo (_ : Nat) : Nat := by assumption
to make a non-constant function with an unnamed argument
Mario Carneiro (Sep 19 2023 at 19:36):
calling the variable x
there would probably trigger the core linter
Mario Carneiro (Sep 19 2023 at 19:37):
the mathlib linter is more about actually detecting constant functions
Last updated: Dec 20 2023 at 11:08 UTC