summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'range.c')
-rw-r--r--range.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/range.c b/range.c
index 157069daa5..1f04eeb63e 100644
--- a/range.c
+++ b/range.c
@@ -2391,18 +2391,17 @@ empty_region_p(VALUE beg, VALUE end, int excl)
* (1..2).overlap?(3..4) # => false
* (1...3).overlap?(3..4) # => false
*
- * This method assumes that there is no minimum value because
- * Ruby lacks a standard method for determining minimum values.
- * This assumption is invalid.
- * For example, there is no value smaller than <tt>-Float::INFINITY</tt>,
- * making <tt>(...-Float::INFINITY)</tt> an empty set.
- * Consequently, <tt>(...-Float::INFINITY)</tt> has no elements in common with itself,
- * yet <tt>(...-Float::INFINITY).overlap?((...-Float::INFINITY))<tt> returns
- * +true+ due to this assumption.
- * In general, if <tt>r = (...minimum); r.overlap?(r)</tt> returns +true+,
- * where +minimum+ is a value that no value is smaller than.
- * Such values include <tt>-Float::INFINITY</tt>, <tt>[]</tt>, <tt>""</tt>, and
- * classes without subclasses.
+ * Note that the method wouldn't make any assumptions about the beginless
+ * range being actually empty, even if its upper bound is the minimum
+ * possible value of its type, so all this would return +true+:
+ *
+ * (...-Float::INFINITY).overlap?(...-Float::INFINITY) # => true
+ * (..."").overlap?(..."") # => true
+ * (...[]).overlap?(...[]) # => true
+ *
+ * Even if those ranges are effectively empty (no number can be smaller than
+ * <tt>-Float::INFINITY</tt>), they are still considered overlapping
+ * with themselves.
*
* Related: Range#cover?.
*/