Author: larry Date: Tue Dec 5 09:37:26 2006 New Revision: 13488 Modified: doc/trunk/design/syn/S03.pod doc/trunk/design/syn/S06.pod
Log: Clarify Set/Bag relationship to KeyHash. Clarify default precedence when creating infix via ::=. Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Tue Dec 5 09:37:26 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 13 Nov 2006 + Last Modified: 5 Dec 2006 Number: 3 - Version: 76 + Version: 77 =head1 Changes to PerlĀ 5 operators @@ -582,10 +582,8 @@ $_ $x Type of Match Implied Matching Code ====== ===== ===================== ============= Any Code:($) scalar sub truth match if $x($_) - Hash Hash hash keys identical match if $_.keys === $x.keys - Hash Set members identical match if $_.keys === $x - Set Set members identical match if $_ === $x - Hash any(Hash) hash key intersection match if exists $_{any(Hash.keys)} + Hash Hash hash keys identical sets match if $_.keys === $x.keys + Hash any(Hash) hash key intersection match if exists $_{any($x.keys)} Hash Array hash value slice truth match if $_{any(@$x)} Hash any(list) hash key slice existence match if exists $_{any(list)} Hash all(list) hash key slice existence match if exists $_{all(list)} @@ -672,6 +670,12 @@ both sides, and we can decide when we see more examples of how it'll work out. +For the purpose of smartmatching, all C<Set> and C<Bag> values are +considered to be of type C<KeyHash>, that is, C<Hash> containers +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). + =head1 Meta operators PerlĀ 6's operators have been greatly regularized, for instance, by @@ -973,6 +977,9 @@ $a foo $b # [foo] $a, $b $a foo $b foo $c # [foo] $a, $b, $c +(Note that any infix generated with C<::=> will default to the precedence +of C<+>. When that is not desired you must use C<is equiv>. See S06.) + If the reduction operator is defined separately from the infix operator, it must associate the same way as the operator used: Modified: doc/trunk/design/syn/S06.pod ============================================================================== --- doc/trunk/design/syn/S06.pod (original) +++ doc/trunk/design/syn/S06.pod Tue Dec 5 09:37:26 2006 @@ -13,9 +13,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 21 Mar 2003 - Last Modified: 28 Nov 2006 + Last Modified: 5 Dec 2006 Number: 6 - Version: 62 + Version: 63 This document summarizes Apocalypse 6, which covers subroutines and the @@ -1366,8 +1366,8 @@ List Lazy Perl list (composed of Seq and Range parts) Seq Completely evaluated (hence immutable) sequence Range A pair of Ordered endpoints; gens lazy Seq in list context - Set Unordered Seq that allows no duplicates - Bag Unordered Seq that allows duplicates + Set Unordered Seq that allows no duplicates (does KeyHash, but ro) + Bag Unordered Seq that allows duplicates (does KeyHash, but ro) Junction Sets with additional behaviours Pair Seq of two elements that serves as a one-element Mapping Mapping Pairs with no duplicate keys