Re: [svn:perl6-synopsis] r13519 - doc/trunk/design/syn

2007-01-08 Thread Larry Wall
On Mon, Jan 08, 2007 at 12:54:30PM +, Luke Palmer wrote:
: On 1/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
: >+Set   Subsetsubset  .any === X.all
: >+Set   Superset  superset.any === X.all
: 
: I think these should be reversed.  Since function application is
: commonly read "of", this:
: 
:Set(2,3) ~~ Subset(1,2,3)
: 
: is likely to be read as "The set of (2,3) is a subset of (1,2,3)".   
: Similarly:
: 
:given $set {
:when Subset(1,2,3) {...}
:}
: 
: is likely to be read "when it's a subset of (1,2,3)".

Okay, that's two strikes against the type fakery approach, since
we also have confusion with the "subset" declarator.  I think maybe
we should go with .contains and .containedby or some other possibly
shorter synonym.  Or maybe .contains and .exists need to be unified,
though the fact that I can't think of the other direction just
points out the fact that .exists has a poor valence linguistically
for expression subsetness.  Maybe we should change .exists to .contains.
Hmm...

Larry


Re: [svn:perl6-synopsis] r13519 - doc/trunk/design/syn

2007-01-08 Thread Luke Palmer

On 1/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

+Set   Subsetsubset  .any === X.all
+Set   Superset  superset.any === X.all


I think these should be reversed.  Since function application is
commonly read "of", this:

   Set(2,3) ~~ Subset(1,2,3)

is likely to be read as "The set of (2,3) is a subset of (1,2,3)".   Similarly:

   given $set {
   when Subset(1,2,3) {...}
   }

is likely to be read "when it's a subset of (1,2,3)".

Luke



Re: [svn:perl6-synopsis] r13519 - doc/trunk/design/syn

2007-01-08 Thread Darren Duncan

At 2:35 AM -0800 1/8/07, [EMAIL PROTECTED] wrote:

+Set   Set   identical sets  $_ === X
+Hash  Set   hash keys same set  $_.keys === X
+Any   Set   force set comparisonSet($_) === X
+Set   Subsetsubset  .any === X.all
+Hash  Subsetsubset of hash keys .any === X.all
+Any   Subsetforce set comparison.Set.any === X.all
+Set   Superset  superset.any === X.all
+Hash  Superset  superset of hash keys   .any === X.all
+Any   Superset  force set comparison.Set.any === X.all


With the last 3 (Superset), shouldn't it be ".all === X.any", which 
is the opposite of what Subset has?



@@ -747,15 +722,28 @@
 KeySet KeyBag KeyHash   Hash
 Class Subset Enum Role  Type
 Subst Grammar   Regex
-Buf Char LazyStrStr
+Char LazyCatStr
 Int UInt etc.   Num
 Match   Capture
+ByteStr or Int
+Buf Str or Array of Int


Possible omission-typo.

Should the lower quoted section mention Superset as it does Subset, 
like the top quoted section already does with this update?


-- Darren Duncan


[svn:perl6-synopsis] r13519 - doc/trunk/design/syn

2007-01-08 Thread larry
Author: larry
Date: Mon Jan  8 02:35:42 2007
New Revision: 13519

Modified:
   doc/trunk/design/syn/S03.pod

Log:
A bunch more "tough love" applied to the smartmatching semantics.
Change $x notation to X notation to better reflect metasyntactic nature.
Num and Str as patterns now consistently force + and ~ context for
optimizability.  They no longer "autogrep" anything.
Arrays now always notionally match the entire list, but can use * as wildcard.
Added table of deprecated semantics and new notations to get the same effect
using pattern retyping, * wildcarding, or just ordinary methods.
Attempted to clarify when buffers can be used as strings.
Renamed LazyStr to LazyCat, which now only cats in string context.
Unified treatment of sets and hash keys under junctive methods.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podMon Jan  8 02:35:42 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 7 Jan 2007
+  Last Modified: 8 Jan 2007
   Number: 3
-  Version: 86
+  Version: 87
 
 =head1 Changes to Perl 5 operators
 
@@ -601,7 +601,7 @@
 compilation unit).  Smart matching is generally done on the current
 "topic", that is, on C<$_>.  In the table below, C<$_> represents the
 left side of the C<~~> operator, or the argument to a C,
-or to any other topicalizer.  C<$x> represents the pattern to be
+or to any other topicalizer.  C represents the pattern to be
 matched against on the right side of C<~~>, or after a C.
 
 The first section contains privileged syntax; if a match can be done
@@ -615,105 +615,80 @@
 is still somewhat privileged, insofar as the C<~~> operator is one
 of the few operators in Perl that does not use multiple dispatch.
 Instead, type-based smart matches singly dispatch to an underlying
-method belonging to the C<$x> pattern object.
+method belonging to the C pattern object.
 
 In other words, smart matches are dispatched first on the basis of the
-pattern's form or type (the C<$x> below), and then that pattern itself
+pattern's form or type (the C below), and then that pattern itself
 decides whether and how to pay attention to the type of the topic
 (C<$_>).  So the second column below is really the primary column.
 The C entries in the first column indicate a pattern that either
 doesn't care about the type of the topic, or that picks that entry
 as a default because the more specific types listed above it didn't match.
 
-$_$xType of Match Implied   Match if
-=== =   =
-Any   Code:($)  scalar sub truth$x($_)
-Any   Code:()   simple closure truth$x() (ignoring $_)
-Any   undef undefined   not defined $_
+$_X Type of Match Implied   Match if (given $_)
+=== =   ===
+Any   Code:($)  scalar sub truthX($_)
+Any   Code:()   simple closure truthX() (ignoring $_)
+Any   undef undefined   not .defined
 Any   * block signature match   block successfully binds to |$_
-Any   .foo  method truth?any($_.foo)
-Any   .foo(...) method truth?any($_.foo(...))
-Any   .(...)list sub call truth ?any($_(...))
-Any   .[...]array value slice truth ?any($_[...])
-Any   .{...}hash value slice truth  ?any($_{...})
-Any   .<...>hash value slice truth  ?any($_<...>)
-
-Any   Bool  simple truth$x.true given $_
-
-Num   Num   numeric equality$_ == $x
-Capture   Num   numeric equality+$_ == $x
-Array Num   array contains number   any(@$_) == $x
-Hash  Num   hash key existence  $_.exists($x)
-Byte  Num   numeric equality+$_ == $x
-Any   Num   numeric equality+$_ == $x
-
-Str   Str   string equality $_ eq $x
-Capture   Str   string equality ~$_ eq $x
-Array Str   array contains string   any(@$_) eq $x
-Hash  Str   hash key existence  $_.exists($x)
-Byte  Str   string equality ~$_ eq $x
-Any   Str   string equality ~$_ eq $x
-
-Buf   Buf   buffer equality $_ eq $x
-Str   Buf   string equality $_ eq Str($x)
-Array Buf   arrays are comparable   $_ »===« @$x
-Hash  Buf   hash key existence  $_.exists($x)
-Any   Buf   buffer equality Buf($_) eq $x
-
-Buf   Byte  buffer contains byte$_.match(/$x/)
-Str   Byte  string contains byteBuf($_).match(/$x/)
-
-Str   Char  string contains char$_.ma