rfc:comparable
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:comparable [2015/02/19 21:30] – Update to version 7.0 against master. aharvey | rfc:comparable [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 7: | Line 7: | ||
- | This RFC offers a Comparable interface which can be used to implement userspace | + | This RFC offers a Comparable interface which can be used to implement userspace |
===== Introduction ===== | ===== Introduction ===== | ||
Line 26: | Line 26: | ||
?> | ?> | ||
</ | </ | ||
+ | |||
+ | This interface intentionally allows variables of any type to be passed to compareTo(): | ||
===== Sample Code ===== | ===== Sample Code ===== | ||
Line 116: | Line 118: | ||
* Comparison of objects with non-objects may become confusing, particularly if scalar casting is added to the mix. | * Comparison of objects with non-objects may become confusing, particularly if scalar casting is added to the mix. | ||
* Comparison of objects with objects of a different class may be confusing or ill-defined. | * Comparison of objects with objects of a different class may be confusing or ill-defined. | ||
+ | * Why we use interface instead of magic method. Comparable is not reserved currently, but methods started with __ are always reserved. | ||
===== Alternative Approaches ===== | ===== Alternative Approaches ===== |
rfc/comparable.1424381429.txt.gz · Last modified: 2017/09/22 13:28 (external edit)