Description
This issue was originally filed by [email protected]
Here's the setup: I have nested asynchronous methods that each take a callback, and I don't care about the event being passed to the callback. For (potentially contrived) example:
var button = document.query('#some-button');
button.on.click.add((_) { // <-- I don't care about the Event, I'll call it \_
// Button is clicked
// ...set up some more UI...
var anotherButton = document.query('#another-button');
anotherButton.on.click.add((_) => window.alert('Success!')); // <-- I don't care about this Event either
});
This may be a contrived example, and in retrospect I'm not sure where I got the idea to name things _
when I don't care about them, this might be a personal convention or I may have cargo culted it from Go. If it isn't a style recommendation something like it should be perhaps.
My point is, I currently see a warning when the inner _
hides the outer _
. But I don't really care, I don't care about either of them. I can rename the second to __
or something, but this arms race quickly becomes annoying.
It might be nice if Dart considered variables named _ as totally ignored placeholders, not caring if they hide other parameters, and potentially showing warnings/errors if they're ever actually used (e.g., _.size
or _.stopPropagation()
).