-
Notifications
You must be signed in to change notification settings - Fork 21
Helper for unused parameters #10790
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 something similar to what we do in Haskell: parameters which start with |
@pjrt The difficulty with a naming convention is named args. On the ticket about requiring args to In Java, a deprecated parameter will never warn if used, so it seems like a safe convention to use the same marker for never warn if unused. Someone recently tweeted that unused parameters are evil. I'll attach a link if I can find it on twitter, which I won't. |
Not warning on |
@som-snytt but seriously, what do you think the right way forward here is? |
@SethTisue it's like adding Also, shouldn't it be called But seriously, I'm fine with this proposal. |
okay so suppose we go with |
Have we considered litotes? (serious part of the comment: I think this is a subset of "let's make silencer part of stdlib", though, if we want to take on that scope creep. Is there a reason it hasn't been done, other than no one wanting to?) |
I gave a moment's thought to implementation while writing my previous comment, and hoped to try something out before the issue was marked good first issue. My momentary insight was that Then this annotation also expresses deprecation-bc-unused more generally, so it is independent of message-suppression as such. |
Sorry my excessive wordiness finally got on fommil's nerves. I'll take this up again, probably on Seth's line, with extra code to respect unused annotation. |
@som-snytt unrelated 😄 I'm just closing all my scala related tickets due to a loss of interest in contributing to the language. I added |
@fommil if we reopen a particular ticket of yours — for example, this one — that someone expresses an interest in, is that okay with you? (or will you just close it again?) |
sure, that's fine, I can always unsubscribe if it's noisy. |
I can be pretty noisy. Sorry, I just did it again. |
This is going to be less easy to do with Scala 2.13's |
This comment has been minimized.
This comment has been minimized.
refs: scala/scala#7527 @fommil The problem is we are extremely overloading the usage of |
Shorter - and more understandable - than @deprecated("unused", ""). See: scala/bug#10790
It would be nice if we could just use |
This comment has been minimized.
This comment has been minimized.
In Rust bindings that begin with an underscore are exempted, which is kind of nice: for example |
This comment has been minimized.
This comment has been minimized.
@dwijnand strikes me as unnecessary to have to name a parameter that you're not using. An underscore should be sufficient, no? |
Underscore is also available. But underscore-prefixed is convenient for cases like when you're only temporarily not using a variable (e.g commented out a code block) or for documentation/labelling purposes. |
This comment has been minimized.
This comment has been minimized.
@nilskp one issue (earlier in discussion) is that param name is part of API (due to named args). The ergonomics might also depend on why the param is unused (no longer used, or should be used in override, etc). |
This makes @som-snytt's wonderful work on unused warnings sooo much easier to enable
There are many valid usecases for ignoring a parameter. For example, in scalaz's
.xmap
.The text was updated successfully, but these errors were encountered: