Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
be very specific about Range ~~ Range semantics
  • Loading branch information
TimToady committed Apr 5, 2012
1 parent a65c854 commit 2019017
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions S03-operators.pod
Expand Up @@ -15,8 +15,8 @@ Synopsis 3: Perl 6 Operators

Created: 8 Mar 2004

Last Modified: 28 Feb 2012
Version: 240
Last Modified: 5 Apr 2012
Version: 241

=head1 Overview

Expand Down Expand Up @@ -3665,7 +3665,7 @@ as a default because the more specific types listed above it didn't match.

Num Range in numeric range X.min <= $_ <= X.max (mod ^'s)
Str Range in string range X.min le $_ le X.max (mod ^'s)
Range Range subset range .bounds.all ~~ X (mod ^'s)
Range Range subset range .empty or .bounds.all ~~ X (mod ^'s)
Any Range in generic range [!after] X.min,$_,X.max (etc.)

Any Type type membership $_.does(X)
Expand Down Expand Up @@ -3881,6 +3881,19 @@ where the keys represent the unique objects and the values represent
the replication count of those unique keys. (Obviously, a C<Set> can
have only 0 or 1 replication because of the guarantee of uniqueness).

Despite the need for an implementation to examine the bounds of a
range in order to perform smartmatching, the result of smartmatching
two C<Range> objects is not actually defined in terms of bounds, but
rather as a subset relationship between two (potentially infinite) sets
of values encompassed by the intervals involved, for any orderable
type such as real numbers, strings, or versions. The result is
defined as true if and only if all potential elements that would
be matched by the left range are also matched by the right range.
Hence it does not matter to what extend the bounds of a empty range
are "overspecified". If the left range is empty, it always matches,
because there exists no value to falsify it. If the right range is
empty, it can match only if the left range is also empty.

The C<Cat> type allows you to have an infinitely extensible string.
You can match an array or iterator by feeding it to a C<Cat>,
which is essentially a C<Str> interface over an iterator of some sort.
Expand Down

0 comments on commit 2019017

Please sign in to comment.