-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Summary of issue:
The accepted proposal PR #2022 Unused Pattern Bindings introduces a new keyword "unused" which should be placed right in front of a name.
Since then, there have been some changes to binding patterns.
Can you confirm that the choice that unused should be right in front of the name (not patterns) still holds?
Details:
The proposal text says only names and not patterns should be in scope of the unused marker.
Is this still our choice?
Consequently:
- one would write
ref unused name x: i32to get a name marked as unused. - writing
unused ref name x: i32would be a parse error.
An additional minor question:
- When someone uses both markers in a binding, e.g.
unused _ : i32, should there be a warning that says that theunusedkeyword has no effect on_?
EDIT: adding three more clarification questions:
-
Question 3 - If I have
fn F(o: C) { var _ : o.Inner }, we should still considerounused, correct? -
Question 4 - There is a check to ensure implementations are the same as interface methods. I believe this check should skip over
unusedmarkers. Can you confirm? -
Question 5 - Can you confirm that "unused" markers do not seem to make sense on interface methods, as they should not be part of contract. Should we flag this as error?
To put it more neutrally: if we do not update the check, then "unused" on an interface of virtual method declaration will force implementations to have unused markers, and thus force the parameters to not be used. This seems undesirable?
Any other information that you want to share?
No response