I'm proposing that the following code should throw "ignored variables cannot be used" errors.
class Main {
static function main() {
for (_ in 0...16) {
trace(_); // error
}
}
static function foo(_) {
trace(_); // error
}
}
I think it's a weird situation that _ has special semantics in pattern matching, bind(), and now even diagnostics mode for locals (#8147), but that you can still use them as if they were regular vars. The common convention for this is already that they're "ignored", so actually using a _ var would be considered bad style anyway. If an error is introduced, _ can be properly documented as a laguage feature for locals.
I know that at least Flambe uses _ as an identifer, but that's only on field level I think? So shouldn't be impacted by this.
This might also allow to revisit #4381.
I'm proposing that the following code should throw "ignored variables cannot be used" errors.
I think it's a weird situation that
_has special semantics in pattern matching,bind(), and now even diagnostics mode for locals (#8147), but that you can still use them as if they were regular vars. The common convention for this is already that they're "ignored", so actually using a_var would be considered bad style anyway. If an error is introduced,_can be properly documented as a laguage feature for locals.I know that at least Flambe uses
_as an identifer, but that's only on field level I think? So shouldn't be impacted by this.This might also allow to revisit #4381.