Re: r30205 - docs/Perl6/Spec

2010-04-02 Thread Leon Timmermans
On Fri, Apr 2, 2010 at 5:59 PM, Aristotle Pagaltzis  wrote:
> He is saying he can’t see how these differ from each other:
>
>      .doit(1,2,3): { $^a <=> $^b }       # okay
> +    .doit(1,2,3): { $^a <=> $^b }       # okay
>
> Or how these two differ from each other:
>
> +    .doit(1,2,3):{ $^a <=> $^b }       # okay
> +    .doit(1,2,3):{ $^a <=> $^b }       # okay
>
> (Neither can I.)
>

Yeah, I only figured what he did mean about 10 second after sending
that email. Guess I shouldn't email before being fully awake in the
morning ;-).

Leon


Re: r30205 - docs/Perl6/Spec

2010-04-02 Thread Aristotle Pagaltzis
* Leon Timmermans  [2010-03-27 09:40]:
> On Sat, Mar 27, 2010 at 2:01 AM, Geoffrey Broadwell  
> wrote:
> >On Fri, 2010-03-26 at 08:38 +0100, pugs-comm...@feather.perl6.nl wrote:
> >>     .doit: { $^a <=> $^b }              # okay
> >>     .doit(): { $^a <=> $^b }            # okay
> >>     .doit(1,2,3): { $^a <=> $^b }       # okay
> >>+    .doit(1,2,3): { $^a <=> $^b }       # okay
> >
> >>+    .doit:{ $^a <=> $^b }              # okay
> >>+    .doit():{ $^a <=> $^b }            # okay
> >>+    .doit(1,2,3):{ $^a <=> $^b }       # okay
> >>+    .doit(1,2,3):{ $^a <=> $^b }       # okay
> >
> >My eyes must be playing tricks on me -- I can't see the
> >difference between the last two lines in each of the above
> >blocks.  What am I missing?
> >
> A space between the colon and the opening brace ;-)

He is saying he can’t see how these differ from each other:

     .doit(1,2,3): { $^a <=> $^b }       # okay
+    .doit(1,2,3): { $^a <=> $^b }       # okay

Or how these two differ from each other:

+    .doit(1,2,3):{ $^a <=> $^b }       # okay
+    .doit(1,2,3):{ $^a <=> $^b }       # okay

(Neither can I.)

Regards,
-- 
Aristotle Pagaltzis // 


Re: r30205 - docs/Perl6/Spec

2010-03-27 Thread Leon Timmermans
A space between the colon and the opening brace ;-)

Leon

On Sat, Mar 27, 2010 at 2:01 AM, Geoffrey Broadwell  wrote:
> On Fri, 2010-03-26 at 08:38 +0100, pugs-comm...@feather.perl6.nl wrote:
>>      .doit: { $^a <=> $^b }              # okay
>>      .doit(): { $^a <=> $^b }            # okay
>>      .doit(1,2,3): { $^a <=> $^b }       # okay
>> +    .doit(1,2,3): { $^a <=> $^b }       # okay
>
>> +    .doit:{ $^a <=> $^b }              # okay
>> +    .doit():{ $^a <=> $^b }            # okay
>> +    .doit(1,2,3):{ $^a <=> $^b }       # okay
>> +    .doit(1,2,3):{ $^a <=> $^b }       # okay
>
> My eyes must be playing tricks on me -- I can't see the difference
> between the last two lines in each of the above blocks.  What am I
> missing?
>
>
> -'f
>
>
>


Re: r30205 - docs/Perl6/Spec

2010-03-26 Thread Geoffrey Broadwell
On Fri, 2010-03-26 at 08:38 +0100, pugs-comm...@feather.perl6.nl wrote:
>  .doit: { $^a <=> $^b }  # okay
>  .doit(): { $^a <=> $^b }# okay
>  .doit(1,2,3): { $^a <=> $^b }   # okay
> +.doit(1,2,3): { $^a <=> $^b }   # okay

> +.doit:{ $^a <=> $^b }  # okay
> +.doit():{ $^a <=> $^b }# okay
> +.doit(1,2,3):{ $^a <=> $^b }   # okay
> +.doit(1,2,3):{ $^a <=> $^b }   # okay

My eyes must be playing tricks on me -- I can't see the difference
between the last two lines in each of the above blocks.  What am I
missing?


-'f




r30205 - docs/Perl6/Spec

2010-03-26 Thread pugs-commits
Author: lwall
Date: 2010-03-26 08:38:16 +0100 (Fri, 26 Mar 2010)
New Revision: 30205

Modified:
   docs/Perl6/Spec/S02-bits.pod
   docs/Perl6/Spec/S03-operators.pod
   docs/Perl6/Spec/S05-regex.pod
   docs/Perl6/Spec/S06-routines.pod
   docs/Perl6/Spec/S12-objects.pod
Log:
[specs] Make it clear that pairs are *not* related to subscripts, but the
corresponding fatarrow semantics in particular, name extenders are just
strings or list of strings, properly indicated by :<> or :() in most cases
(this includes all operator names).  Forbid name extension using :{}, and
since names may no longer be extended with :{}, we can free up that notation
for supplying a closure as a first argument to a method without an intervening
space.  (We can't also get rid of the colon, or it's a hash subscript.)


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2010-03-26 04:10:22 UTC (rev 30204)
+++ docs/Perl6/Spec/S02-bits.pod2010-03-26 07:38:16 UTC (rev 30205)
@@ -13,8 +13,8 @@
 
 Created: 10 Aug 2004
 
-Last Modified: 12 Mar 2010
-Version: 208
+Last Modified: 26 Mar 2010
+Version: 209
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -2919,14 +2919,14 @@
 infix:<+>
 infix:<<+>>
 infix:«+»
-infix:['+']
+infix:('+')
 
 Despite the appearance as a subscripting form, these names are resolved
 not at run time but at compile time.  The pseudo-subscripts need not
 be simple scalars.  These are extended with the same two-element list:
 
 infix:
-infix:['??','!!']
+infix:('??','!!')
 
 An identifier may be extended with multiple named identifier
 extensions, in which case the names matter but their order does not.
@@ -3280,10 +3280,10 @@
 16 => $somevalue:16($somevalue) radix conversion function
 '' => $x:($x)   arglist or signature literal
 '' => ($x,$y)   :($x,$y)arglist or signature literal
-'' =>:identifier extension
-'' => «x»   :«x»identifier extension
-'' => [$x,$y]   :[$x,$y]identifier extension
-'' => { .say }  :{ .say }   adverbial block
+'' =>:name extension
+'' => «x»   :«x»name extension
+'' => ($x,$y)   :($x,$y)name extension
+'' => { .say }  :{ .say }   adverbial block (not allowed on names)
 
 All of the adverbial forms (including the normal ones with
 identifier keys) are considered special tokens and are recognized
@@ -3314,6 +3314,22 @@
 standard Perl 6 grammar knows the current set of infix operators,
 for instance.)
 
+Only identifiers that produce a list of one or more values (preferably
+strings) are allowed as name extensions; in particular, closures
+do not qualify as values, so the C<:{...}> form is not allowed as a
+name extender.  In particular, this frees up the block form after a method
+name, so it allows us to parse a block as a method argument:
+
+@stuff.sort:{ +$_ }.map:{ $_ * 2 }
+
+These might look like it is using pairs, but it is really equivalent to
+
+@stuff.sort: { +$_ }.map: { $_ * 2 }
+
+and the colons are not introducing pairs, but rather introducing
+the argument list of the method.  (In any other location, C<:{...}>
+would be taken as a pair mapping the null key to a closure.)
+
 Either fatarrow or adverbial pair notation may be used to pass
 named arguments as terms to a function or method.  After a call with
 parenthesized arguments, only the adverbial syntax may be used to pass
@@ -3327,8 +3343,9 @@
 
 Note that (as usual) the C<{...}> form (either identifier-based
 or special) can indicate either a closure or a hash depending on
-the contents.  It does I always indicate a subscript despite
-being parsed as one.  (The function to which it is passed can I
+the contents.  It does I indicate a subscript, since C<:key{}> is
+really equivalent to C {}>, and the braces are not behaving
+as a postfix at all.  (The function to which it is passed can I
 the value as a subscript if it chooses, however.)
 
 Note also that the C<<  >> form is not a subscript and is
@@ -4414,16 +4431,16 @@
 category:   prefix:<+>
 circumfix:<[ ]> [ @x ]
 dotty:<.=>  $obj.=method
-infix_circumfix_meta_operator:{'»','«'} @a »+« @b
+infix_circumfix_meta_operator:('»','«') @a »+« @b
 infix_postfix_meta_operator:<=> $x += 2;
 infix_prefix_meta_operator:  $x !~~ 2;
 infix:<+>   $x + $y
 package_declarator:   role Foo;
 postcircumfix:<[ ]> $x[$y] or $x.[$y]
-postfix_prefix_meta_operator:{'»'}  @array »++
+postfix_prefix_meta_operat