Skip to content

Conversation

@eeckstein
Copy link
Contributor

  • remove filterUsers(ofType:), because it's a duplication of users(ofType:)
  • rename filterUses(ofType:) -> filter(usersOfType:)
  • rename ignoreUses(ofType:) -> ignore(usersOfType:)
  • rename getSingleUser -> singleUser
  • implement singleUse with Sequence.singleElement
  • implement ignoreDebugUses with ignore(usersOfType:)

This is a follow-up of eb1d5f4.

* remove `filterUsers(ofType:)`, because it's a duplication of `users(ofType:)`
* rename `filterUses(ofType:)` -> `filter(usersOfType:)`
* rename `ignoreUses(ofType:)` -> `ignore(usersOfType:)`
* rename `getSingleUser` -> `singleUser`
* implement `singleUse` with `Sequence.singleElement`
* implement `ignoreDebugUses` with `ignore(usersOfType:)`

This is a follow-up of swiftlang@eb1d5f4.
@eeckstein eeckstein requested a review from atrick October 16, 2025 08:17
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test macos

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think the method name should reflect the behavior rather than relying on argument labels. For example, folding the closure argument of filter should usually refine the method name:
Sequence<Int>.filterDivisible(by: 7)

As Erik explained, the name should not repeat Uses, which would be redundant. And the name should not say Users since it actually returns Operand not Instruction. So any of these are valid:

  1. filterType(_:)
  2. filter(type:)
  3. filter(usersOfType:)

I slightly prefer the less verbose options since I think users is redundant with type. But any of the above are ok.

@eeckstein eeckstein merged commit de14247 into swiftlang:main Oct 16, 2025
3 checks passed
@eeckstein eeckstein deleted the operand-apis branch October 16, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants