Skip to content

Instantly share code, notes, and snippets.

@masak
Created August 29, 2014 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masak/1322886ed7092c522bd8 to your computer and use it in GitHub Desktop.
Save masak/1322886ed7092c522bd8 to your computer and use it in GitHub Desktop.
Draft of change to smartmatching semantics
diff --git a/S03-operators.pod b/S03-operators.pod
index a6f3eb5..2d651b0 100644
--- a/S03-operators.pod
+++ b/S03-operators.pod
@@ -14,8 +14,8 @@ Synopsis 3: Operators
Created: 8 Mar 2004
- Last Modified: 18 Aug 2014
- Version: 279
+ Last Modified: 29 Aug 2014
+ Version: 280
=head1 Overview
@@ -3687,10 +3687,10 @@ as a default because the more specific types listed above it didn't match.
Mix Mix identical bags $_ === X
Any Mixy force mix comparison $_.Mix === X.Mix
- Positional Array arrays are comparable $_ «===» X (dwims * wildcards!)
+ Positional Array arrays are comparable $_ «~~» X
Associative Array keys/list are comparable +X == +$_ and $_{X.all}:exists
Callable Positional list vs predicate so $_(X)
- Any Positional lists are comparable $_[] «===» X[]
+ Any Positional lists are comparable $_[] «~~» X[]
Hash Hash hash mapping equivalent $_ eqv X
Associative Hash force hash comparison $_.Hash eqv X
@@ -3750,7 +3750,7 @@ the table assumes the following types will behave similarly:
Actual type Use entries for
=========== ===============
- Iterator Array List
+ Iterator Parcel Array
named values created with
Class, Enum, or Role,
or generic type binding Type
@@ -3838,11 +3838,11 @@ Various proposed-but-deprecated smartmatch behaviors may be easily
$_ X Type of Match Wanted What to use on the right
====== === ==================== ========================
Array Num array element truth .[X]
- Array Num array contains number *,X,*
- Array Str array contains string *,X,*
- Array Seq array begins with seq X,*
- Array Seq array contains seq *,X,*
- Array Seq array ends with seq *,X
+ Array Num array contains number X.any
+ Array Str array contains string X.any
+ Array Seq array begins with seq Fuzzy.new(|X, *)
+ Array Seq array contains seq Fuzzy.new(*,|X,*)
+ Array Seq array ends with seq Fuzzy.new(*,|X)
Hash Str hash element truth .{X}
Hash Str hash key existence .{X}:exists
Hash Num hash element truth .{X}
@@ -3862,7 +3862,7 @@ Various proposed-but-deprecated smartmatch behaviors may be easily
Any Set superset relation X.{.all}:exists
Any Hash superset relation X.{.all}:exists
Any Set sets intersect .{X.any}:exists
- Set Array subset relation X,* # (conjectured)
+ Set Array subset relation not smart match; $_ (<) set(X)
Array Regex match array as string .Cat.match(X) cat(@$_).match(X)
(Note that the C<.cat> method and the C<Cat> type coercion both take a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment