@@ -15,8 +15,8 @@ Synopsis 3: Perl 6 Operators
15
15
16
16
Created: 8 Mar 2004
17
17
18
- Last Modified: 6 Jun 2011
19
- Version: 225
18
+ Last Modified: 11 Jul 2011
19
+ Version: 226
20
20
21
21
=head1 Overview
22
22
@@ -3463,9 +3463,22 @@ is hereby deprecated.)
3463
3463
A C<Range> may be iterated only if the type in question supports the C<.succ> method.
3464
3464
If it does not, any attempt to iterate returns failure.
3465
3465
3466
- Smart matching against a C<Range> object smartmatches the
3467
- endpoints in the domain of the object being matched, so fractional
3468
- numbers are I<not> truncated before comparison to integer ranges:
3466
+ Smart matching against a C<Range> object does comparisons
3467
+ (by coercion, if necessary) in the C<Real> domain
3468
+ if either endpoint does C<Real>. Otherwise comparison is in
3469
+ the C<Stringy> domain if either argument does C<Stringy>.
3470
+ Otherwise the min's type is used if it defines ordering, or if not,
3471
+ the max's type. If neither min nor max have an ordering,
3472
+ dispatch to .ACCEPTS fails. It may also fail if the ordering
3473
+ in question does not have any way to coerce the object
3474
+ being smartmatched into an appropropriate type implied by the
3475
+ chosen domain of ordering.
3476
+
3477
+ In general, the domain of comparison should be a type that can
3478
+ represent all the values in question, if possible. Hence, since Int
3479
+ is not such a type, it is promoted to a Real, so fractional numbers
3480
+ are I<not> truncated before comparison to integer ranges. Instead the
3481
+ integers are assumed to represent points on the real number line:
3469
3482
3470
3483
1.5 ~~ 1^..^2 # true, equivalent to 1 < 1.5 < 2
3471
3484
2.1 ~~ 1..2 # false, equivalent to 1 <= 2.1 <= 2
@@ -3481,8 +3494,8 @@ inferred from the right operand. (A star on both sides is not allowed.)
3481
3494
'a'..* # 'a' le $_
3482
3495
*..0 # -Inf .. 0
3483
3496
*..* # Illegal
3484
- 1 .2.3..* # Any version higher than 1.2.3.
3485
- May..* # May through December
3497
+ v1 .2.3 .. * # Any version higher than 1.2.3.
3498
+ May .. * # May through December
3486
3499
3487
3500
An empty range cannot be iterated; it returns a C<Nil> instead. An empty
3488
3501
range still has a defined C<.min> and C<.max>, but one of the following is
0 commit comments