Skip to content
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

Idea: final class Teds\ComparableObject {public readonly $key: mixed; public $value; } #201

Open
TysonAndre opened this issue Nov 10, 2022 · 0 comments

Comments

@TysonAndre
Copy link
Owner

  • This could throw for keys that don't have a stable comparison order, e.g. most objects
  • stable_compare could check for instances of this class
  • This could be used in StableMinHeap, stable sorts, etc.
  • This class would override the regular object comparison handler to compare $key if the instances were the same to be usable in <=>, <, sort, etc.
@TysonAndre TysonAndre changed the title Idea: final class Teds\ComparableObject {public $key: mixed; public $value; } Idea: final class Teds\ComparableObject {public readonly $key: mixed; public $value; } Nov 10, 2022
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

No branches or pull requests

1 participant