Stream: ideas

Topic: warning for _ instead of single tag


view this post on Zulip Richard Feldman (Jul 31 2023 at 13:28):

I wonder if we should have a warning that suggests writing this:

Err NotFound -> ...

...when you currently have this:

Err _ -> ...

because it's clearer that you're not discarding any error info; rather, there isn't any more info to show

view this post on Zulip Richard Feldman (Jul 31 2023 at 13:29):

in other words, the warning would occur when there's an _ being used in place of a single tag (or {} I suppose) in a pattern

view this post on Zulip Richard Feldman (Jul 31 2023 at 13:29):

I guess that would also apply to \_ -> and \{} -> or for that matter {} <- and _ <-

view this post on Zulip Richard Feldman (Jul 31 2023 at 13:29):

since those are all patterns too

view this post on Zulip J.Teeuwissen (Jul 31 2023 at 13:59):

using an _ could indicate that no matter the reason you want to perform this action. Which is especially important when additional options can be added later, even if there is only a single option now.


Last updated: Jun 16 2026 at 16:19 UTC