Re: r25060 - docs/Perl6/Spec src/perl6

2009-01-29 Thread Eirik Berg Hanssen
Jon Lang datawea...@gmail.com writes:

 So $a -= $b is equivalent to $b = $a, not -($a = $b).  OK.
  I'd suggest choosing a better character for the meta-operator (one
 that conveys the meaning of reversal of order rather than opposite
 value); but I don't think that there is one.

  A transposition of the parameters of a binary operator?  Well,
transpositions are occasionally denoted by ticks:

  $a  op' $b === $b  op $a

  $a =' $b === $b = $a
  $a cmp' $b === $b cmp $a
  $a leg' $b === $b leg $a

  ... hmmm ...

  $a  -' $b === $b  - $a
  $a  /' $b === $b  / $a
  $a **' $b === $b ** $a

  ... and just to complete the madness ...

  $a  =' $b === $b  = $a

  ...

  ... transposed assignment! :-)


  Somehow I think Huffman may have something to say about this. :)


Eirik
-- 
So this is the Sword of Immortality?  Huh?
 What's it doin' in a CRYPT?!
   --- John S. Novak, III, quoting an unnamed player


Re: r25102 - docs/Perl6/Spec

2009-01-29 Thread Mark J. Reed
I took the quotation marks to indicate an intentional
misspelling/coinage:  perl + prelude = perlude.




On 1/29/09, Moritz Lenz mor...@faui2k3.org wrote:
 pugs-comm...@feather.perl6.nl wrote:
 +PERL# Lexical symbols in the standard perlude

 Did you mean prelude instead?

 Moritz


-- 
Sent from Gmail for mobile | mobile.google.com

Mark J. Reed markjr...@gmail.com


Re: r25060 - docs/Perl6/Spec src/perl6

2009-01-29 Thread Larry Wall
On Thu, Jan 29, 2009 at 09:00:06AM +0100, Eirik Berg Hanssen wrote:
: Jon Lang datawea...@gmail.com writes:
: 
:  So $a -= $b is equivalent to $b = $a, not -($a = $b).  OK.
:   I'd suggest choosing a better character for the meta-operator (one
:  that conveys the meaning of reversal of order rather than opposite
:  value); but I don't think that there is one.
: 
:   A transposition of the parameters of a binary operator?  Well,
: transpositions are occasionally denoted by ticks:
: 
:   $a  op' $b === $b  op $a
: 
:   $a =' $b === $b = $a
:   $a cmp' $b === $b cmp $a
:   $a leg' $b === $b leg $a
: 
:   ... hmmm ...
: 
:   $a  -' $b === $b  - $a
:   $a  /' $b === $b  / $a
:   $a **' $b === $b ** $a
: 
:   ... and just to complete the madness ...
: 
:   $a  =' $b === $b  = $a
: 
:   ...
: 
:   ... transposed assignment! :-)
: 
: 
:   Somehow I think Huffman may have something to say about this. :)

The basic problem with ' is visual and psychological.  It needs to
be something more visible out front where it is noticed first, so
maybe instead of - it should be R (for reversed):

$a  Rop $b === $b  op $a
  
$a R= $b === $b = $a
$a Rcmp $b === $b cmp $a
$a Rleg $b === $b leg $a
  
... hmmm ...
  
$a  R- $b === $b  - $a
$a  R/ $b === $b  / $a
$a R** $b === $b ** $a
  
... and just to complete the madness ...
  
$a  R= $b === $b  = $a

There is, after all, precedent with X...X.

Hmm, I suppose an argument could be made for simplifying meta-cross
to just X...

@a X~ @b
@a X* @b
...

Trying to think of the downsides, and having trouble...

Larry


r25113 - docs/Perl6/Spec src/perl6

2009-01-29 Thread pugs-commits
Author: lwall
Date: 2009-01-29 21:32:51 +0100 (Thu, 29 Jan 2009)
New Revision: 25113

Modified:
   docs/Perl6/Spec/S03-operators.pod
   src/perl6/STD.pm
Log:
[STD, S03] slaughter of the LTM metatokens
STD now runs considerably faster
Freed from LTM, metaoperators may now be nested arbitrarily deep
new [op] notation for infix functions


Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2009-01-29 15:35:07 UTC (rev 25112)
+++ docs/Perl6/Spec/S03-operators.pod   2009-01-29 20:32:51 UTC (rev 25113)
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall la...@wall.org
   Date: 8 Mar 2004
-  Last Modified: 27 Jan 2009
+  Last Modified: 29 Jan 2009
   Number: 3
-  Version: 150
+  Version: 151
 
 =head1 Overview
 
@@ -49,7 +49,7 @@
 R  Item assignment   = := ::= = += -= **= xx= .=
 L  Loose unary   true not :by(2)
 X  Comma operator, p5= :
-X  List infixZ minmax X X~X X*X XeqvX ...
+X  List infixZ minmax X X~ X* Xeqv ...
 R  List prefix   print push say die map substr ... [+] [*] any $ @
 X  Loose and and andthen
 X  Loose or  or xor orelse
@@ -1697,9 +1697,9 @@
 
 Cross hyperoperators
 
-@files X~X '.' X~X @extensions
-1..10 X*X 1..10
-@x XeqvX @y
+@files X~ '.' X~ @extensions
+1..10 X* 1..10
+@x Xeqv @y
 etc.
 
 See L/Cross operators.
@@ -3507,21 +3507,24 @@
 
 The precedence of any negated operator is the same as the base operator.
 
+The operator
+
+!%
+
+is specially allowed for testing even divisibility by an integer.
+
 Note that logical operators such as C|| and C^^ do not return a Bool,
 but rather one of the operands.
 
 =head2 Reversed comparison operators
 
-Any infix comparison operator returning type COrder may be transformed into 
its reversed sense
-by prefixing with C-.
+Any infix operator may be called with its two arguments reversed
+by prefixing with CR.  For instance, to do reversed comparisons:
 
--cmp
--leg
--=
+Rcmp
+Rleg
+R=
 
-To avoid confusion with the C-= operator, you may not modify
-any operator already beginning with C=.
-
 The precedence of any reversed operator is the same as the base operator.
 
 =head2 Hyper operators
@@ -3964,22 +3967,22 @@
 =head2 Cross operators
 
 The final metaoperator is the cross metaoperator.  It is formed syntactically
-by placing an infix operator between two CX characters.  It applies the
+by placing an infix operator after the CX character.  It applies the
 modified operator across all groupings of its list arguments as returned
 by the ordinary C infix:X  operator.  All
 cross operators are of list infix precedence, and are list associative.
 
 The string concatenating form is:
 
-a b X~X 1 2   #  'a1', 'a2', 'b1', 'b2'
+a b X~ 1 2   #  'a1', 'a2', 'b1', 'b2'
 
-The CX~X operator desugars to something like:
+The CX~ operator desugars to something like:
 
-[~]«( a b X,X 1 2 )  #  'a1', 'a2', 'b1', 'b2'
+[~]«( a b X, 1 2 )  #  'a1', 'a2', 'b1', 'b2'
 
-The list concatenating form, CX,X, when used like this:
+The list concatenating form, CX,, when used like this:
 
-a b X,X 1,2 X,X x y
+a b X, 1,2 X, x y
 
 produces
 
@@ -3998,15 +4001,15 @@
 For the general form, any existing, non-mutating infix operator
 may be used.
 
-1,2 X*X 3,4   # 3,4,6,8
+1,2 X* 3,4   # 3,4,6,8
 
 (Note that C ==  and C ==  are considered mutating, as well as
 all assignment operators.)
 
 If the underlying operator is non-associating, so is the metaoperator:
 
-@a XcmpX @b XcmpX @c   # ILLEGAL
-@a XeqX @b XeqX @c # ok
+@a Xcmp @b Xcmp @c   # ILLEGAL
+@a Xeq @b Xeq @c # ok
 
 In fact, though the CX operators are all list associative
 syntactically, the underlying operator is always applied with its
@@ -4019,44 +4022,37 @@
 
 =head2 Nesting of metaoperators
 
-In order to match operators by the longest-token rule, the
-compiler pregenerates various metaforms based on existing operators.
-Unfortunately, with nesting metaoperators there are an infinite number
-of metaforms, so we arbitrarily say that no metacircumfix form is
-pregenerated that uses the same grammatical category more than once.
-Therefore forms like C[+=] and C»!===« and CX*X= are generated,
-but not forms like C»X*X« or CX«*»X or C +== .
-You do get C[X*X],
-though, because reduction is prefix_circumfix_meta_operator while
-cross operators are infix_circumfix_meta_operator.
+Constructs containing metaoperators are considered metatokens,
+by which we mean that they are not subject to ordinary longest-token
+matching rules, although their components are.  Like ordinary
+tokens, however, metaoperators do not allow whitespace between
+their subparts.
 
-This use-each-category-once limitation is not a great hardship since
-you can define your own infix operators.  Suppose you say
+Any