Re: r29344 - docs/Perl6/Spec/S32-setting-library

2009-12-17 Thread Carl Mäsak
Larry , through S-ro commitbot:
 +Since a CKeyHash, unlike a CBag, is mutable, C.pick works
 +directly on the CKeyHash, modifying it in place.  You must copy
 +the CKeyHash first if you don't want it modified in place.

This violates Least Surprise for me. An Array is also mutable, but it
doesn't get modified in place.

Generally, Perl 6 seems built around the premise that if you want to
modify collection types or stringy things in place, you're to use
C.= -- cf. chop, chomp, sort, reverse, invert, rotate, and all the
methods on Numeric. There are still functions/methods which mutate by
default: the push/pop/shift/unshift/splice family. But I kinda see
.pick() as belonging in the former group.

Oh, and see also the excellent clarification of semantic behaviours
under 'rotate' in S32-setting-library/Containers.pod as to why
non-mutating is a good default.

// Carl


r29352 - in docs/Perl6/Spec: . S32-setting-library

2009-12-17 Thread pugs-commits
Author: masak
Date: 2009-12-17 11:45:37 +0100 (Thu, 17 Dec 2009)
New Revision: 29352

Modified:
   docs/Perl6/Spec/S03-operators.pod
   docs/Perl6/Spec/S32-setting-library/Basics.pod
Log:
kill off REJECTS

It was generally agreed on #perl6 that the REJECTS method doesn't add
anything to the functionality of smartmatching, except perhaps confusion.

Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2009-12-17 02:35:41 UTC (rev 29351)
+++ docs/Perl6/Spec/S03-operators.pod   2009-12-17 10:45:37 UTC (rev 29352)
@@ -15,8 +15,8 @@
 
 Created: 8 Mar 2004
 
-Last Modified: 28 Nov 2009
-Version: 181
+Last Modified: 17 Dec 2009
+Version: 182
 
 =head1 Overview
 
@@ -3346,8 +3346,7 @@
 
 The exact form of the underlying type-based method dispatch is:
 
-X.ACCEPTS($_)  # for ~~
-X.REJECTS($_)  # for !~~
+X.ACCEPTS($_)
 
 As a single dispatch call this pays attention only to the type of
 CX initially.  The CACCEPTS method interface is defined by the
@@ -3357,10 +3356,6 @@
 an CAny on the left above.  Or the class may choose to provide
 multiple CACCEPTS multi-methods within the class, and these
 will then redispatch within the class based on the type of C$_.
-The class may also define one or more CREJECTS methods; if it does
-not, the default CREJECTS method from the CPattern role defines
-it in terms of a negated CACCEPTS method call.  This generic method
-may be less efficient than a custom CREJECTS method would be, however.
 
 The smartmatch table is primarily intended to reflect forms and types that
 are recognized at compile time.  To avoid an explosion of entries,
@@ -3381,7 +3376,7 @@
 Buf Str or Array of Int
 
 (Note, however, that these mappings can be overridden by explicit
-definition of the appropriate CACCEPTS and CREJECTS methods.
+definition of the appropriate CACCEPTS methods.
 If the redefinition occurs at compile time prior to analysis of the
 smart match then the information is also available to the optimizer.)
 

Modified: docs/Perl6/Spec/S32-setting-library/Basics.pod
===
--- docs/Perl6/Spec/S32-setting-library/Basics.pod  2009-12-17 02:35:41 UTC 
(rev 29351)
+++ docs/Perl6/Spec/S32-setting-library/Basics.pod  2009-12-17 10:45:37 UTC 
(rev 29352)
@@ -19,8 +19,8 @@
 
 Created: 19 Mar 2009 extracted from S29-functions.pod
 
-Last Modified: 1 Oct 2009
-Version: 3
+Last Modified: 17 Dec 2009
+Version: 4
 
 The document is a draft.
 
@@ -214,7 +214,6 @@
 
  role Pattern {
  method ACCEPTS($self:, $other) {...}
- method REJECTS($self:, $other) {...}
  }
 
 =over
@@ -223,10 +222,6 @@
 
 Used in smartmatching; see S03.
 
-=item REJECTS
-
-Used in smartmatching; see S03.
-
 =back
 
 =head2 Scalar



r29353 - docs/Perl6/Spec

2009-12-17 Thread pugs-commits
Author: masak
Date: 2009-12-17 11:46:33 +0100 (Thu, 17 Dec 2009)
New Revision: 29353

Modified:
   docs/Perl6/Spec/S02-bits.pod
   docs/Perl6/Spec/S09-data.pod
Log:
fixed one typo and one ws inconsistency

Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2009-12-17 10:45:37 UTC (rev 29352)
+++ docs/Perl6/Spec/S02-bits.pod2009-12-17 10:46:33 UTC (rev 29353)
@@ -2168,7 +2168,7 @@
 
 CORE = SETTING  UNIT  (your_block_here)
 
-The outermost packages scopes nest like this, traversed via CPARENT:
+The outermost package scopes nest like this, traversed via CPARENT:
 
 GLOBAL   (your_package_here)
 

Modified: docs/Perl6/Spec/S09-data.pod
===
--- docs/Perl6/Spec/S09-data.pod2009-12-17 10:45:37 UTC (rev 29352)
+++ docs/Perl6/Spec/S09-data.pod2009-12-17 10:46:33 UTC (rev 29353)
@@ -239,7 +239,7 @@
 @array[*]
 @array[0 .. *]
 @array[0 .. *-1]
-@array[-Inf .. *-1 ]
+@array[-Inf .. *-1]
 
 because they all end up meaning the same thing.
 



Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson
At 17:10 -0500 2009-12-16, Dave Whipp wrote:
define the return value more formally, something like:

   our multi method polar (Complex $nim: -- [ Real $mag where 0..Inf,
Real $angle where -¼ ..^ ¼ ]) is export { ... }


In complex analysis it is often legitimate to work with numbers
where the range of $angle is something other than -¼ ..^ ¼,
either because you want the branch cut somewhere else ( 0 ..^ 2¼ )
or you are on some other sheet ( ¼ ..^ 3¼ )

Does the above proposal stand in the way of this sort of work?

Regards,
Todd Olson


Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson

At 19:46 -0500 2009-12-16, Dave Whipp wrote:

yary wrote:

 At 00:15 +0100 12/17/09, Moritz Lenz wrote:

 Not quite, .abs returns one of the polar coordinates (the magnitude), so
 only a method is missing that returns the angle.

 Any ideas for a good name?


 Would a method called phi with a unicode synonym É be too obtuse?



Anything wrong with .angle?



In physics and electrical engineering we often speak of the phase


Regards,
Todd Olson

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp

Moritz Lenz wrote:

Dave Whipp wrote:
[cut] Contrast with Rat which has both separate accessors and the 
nude method (a name that could possibly be improved to avoid 
adult-content filters)


suggestions welcome.


Attempting to generalize: what we want is an operator that extracts a 
Seq of values from an object based on a positive criteria. For string 
objects, this description matches the Ccomb method. Generalizing:


  my @words = $line.comb( /\S+/ );
  my ($num, $denom) = $num.comb( :Ratio );
  my ($mag, $phase) = $z.comb( :Complex::Polar );
  my ($re, $im) = $z.comb( :Complex::Cartesian );
  my ($x, $y) = $vector.comb( [1,0], [0,1] );


Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Jon Lang
Dave Whipp wrote:
 Moritz Lenz wrote:

 Dave Whipp wrote:

 [cut] Contrast with Rat which has both separate accessors and the nude
 method (a name that could possibly be improved to avoid adult-content
 filters)

 suggestions welcome.

 Attempting to generalize: what we want is an operator that extracts a Seq of
 values from an object based on a positive criteria. For string objects, this
 description matches the Ccomb method. Generalizing:

  my @words = $line.comb( /\S+/ );
  my ($num, $denom) = $num.comb( :Ratio );
  my ($mag, $phase) = $z.comb( :Complex::Polar );
  my ($re, $im) = $z.comb( :Complex::Cartesian );
  my ($x, $y) = $vector.comb( [1,0], [0,1] );


I like the idea of a general mechanism for producing a list of an
object's attributes; but I don't think that .comb() is the way to go
about it.  Rather, I'd use .^attr().

  my ($num, $denom) = $num.^attr; # $num.WHAT == Ratio;
  my ($mag, $phase) = Complex::Polar($z).^attr;
  my ($re, $im) = Complex::Cartesian($z).^attr;
  my ($x, $y) = $vector.^attr »·« ( [1, 0], [0, 1] );

-- 
Jonathan Dataweaver Lang


Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp

Jon Lang wrote:

  my ($num, $denom) = $num.^attr; # $num.WHAT == Ratio;
  my ($mag, $phase) = Complex::Polar($z).^attr;
  my ($re, $im) = Complex::Cartesian($z).^attr;
  my ($x, $y) = $vector.^attr »·« ( [1, 0], [0, 1] );


If I'm reading this right, the .^attr is exposing implementation details 
of the object to get its components. To my mind that is not desirable.


And I think there's a Math error in the 4th line: you don't need the 
components of a vector to do a dot product with that vector -- so it is just


   my ($x, $y) = $vector «·« ( [1, 0], [0, 1] );

Which makes me wonder if all of them are just the dot-product of an 
object with a role (i.e. it uses the .^attr of the role, not the object):


   my ($num, $denom) = $real_number · :Ratio;
   my ($mag, $phase) = $complex_number · :Complex::Polar;

Which has a pleasing symmetry with the dot used for method calls


Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Jon Lang
Dave Whipp wrote:
 Jon Lang wrote:

  my ($num, $denom) = $num.^attr; # $num.WHAT == Ratio;
  my ($mag, $phase) = Complex::Polar($z).^attr;
  my ($re, $im) = Complex::Cartesian($z).^attr;
  my ($x, $y) = $vector.^attr »·« ( [1, 0], [0, 1] );

 If I'm reading this right, the .^attr is exposing implementation details of
 the object to get its components. To my mind that is not desirable.

The reason that HOW is spelled in allcaps is because it can be used in
undesirable ways.  In particular, whedn you introspect an object,
you're looking at its implementation details.

And really, my whole point is that the implementation details are
(conceptually) the only thing that distinguishes Complex::Polar from
Complex::Cartesian.  More on this below.

 And I think there's a Math error in the 4th line: you don't need the
 components of a vector to do a dot product with that vector -- so it is just

   my ($x, $y) = $vector «·« ( [1, 0], [0, 1] );

True enough.

 Which makes me wonder if all of them are just the dot-product of an object
 with a role (i.e. it uses the .^attr of the role, not the object):

The role may not have a .^attr; in particular, I'd expect the
following to be true:

  role Complex {
...
method re() { ... }
method im() { ... }
method abs() { ... }
method arg() { ... }
  } # no has declarations
  class Complex::Cartesian does Complex { has $re, $im; ... }
  class Complex::Polar does Complex { has $abs, $arg; ... }

There's another problem with my proposal, namely the fact that
introspection of a package's component parts shouldn't be expected to
preserve the order of said components.  But setting that aside for the
moment: Complex.^attr ought to return an empty list, since no
attributes were declared in it; Complex::Polar.^attr ought to return a
magnitude and an argument (i.e., an angle); and
Complex::Cartesian.^attr ought to return a real value and an imaginary
value.

-- 
Jonathan Dataweaver Lang


Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson
At 14:54 -0500 2009-12-17, Jon Lang wrote:
Dave Whipp wrote:
And really, my whole point is that the implementation details are
(conceptually) the only thing that distinguishes Complex::Polar from
Complex::Cartesian.


All though  both  e^(i ¼)  and  e^(i 3 ¼)  evaluate to -1 + 0i
it is often useful to be able to distinguish them.
So perhaps the question is do we really want Perl6 to automatically
convert e^(i 3 ¼)  to  e^(i ¼)  internally.  If not, then
we really do want some sort of access to the implementation details.


This is similar to the question for rational numbers if we
really want Perl6 to automatically convert  4/8  to 1/2 
and 51/68 to 3/4 internally


So if you mean that we should have access to the implementation details
to see if we have 4/8 rather than 1/2, then I'm with you.

Regards,
Todd Olson


Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Doug McNutt
At 11:54 -0800 12/17/09, Jon Lang wrote:
 And I think there's a Math error in the 4th line: you don't need the
 components of a vector to do a dot product with that vector -- so it is just

   my ($x, $y) = $vector «·« ( [1, 0], [0, 1] );

True enough.

 Which makes me wonder if all of them are just the dot-product of an object
 with a role (i.e. it uses the .^attr of the role, not the object):

I became an observer a few years ago when vector operations were being 
introduced in perl6. I was excited, thinking that perl6 was actually gong to do 
mathematics.

After a while I became resigned to the fact that dot and cross products were 
not what was being offered. Instead a product of two vectors was to be simply a 
component by component multiply that produced another vector of the same size 
 as the arguments.

It appears that is what is being done in the formula above. OK. Perhaps there 
really are uses for that operation in the computing world. But please don't 
call the result a dot product! It will be misinterpreted forever in the same 
way that the term kilo was forever made ambiguous when computer types decided 
it meant 2**10 instead of 10**3.

Dot and cross products have been around since Newton. Kilo since the mid 1800s.

Phase is a good name for the angular part of a polar complex number. It's 
actually used that way by electrical engineers working with three phase power 
distribution. But those guys also expect a dot product to be a scalar which is 
the sum of the products of the vector components. True power is charged for by 
computing the dot product of voltage and current vectors expressed as complex 
numbers. That requires the original meaning of the dot product.

$dotproduct = @vector1 . @vector2;

In scalar context would be nice but it can come later as an add-on.

--

-- From the U S of A, the only socialist country that refuses to admit it. --


Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp

Doug McNutt wrote:


my ($x, $y) = $vector «·« ( [1, 0], [0, 1] );



After a while I became resigned to the fact that dot and cross
products were not what was being offered. Instead a product of two
vectors was to be simply a component by component multiply that
produced another vector of the same size  as the arguments.

It appears that is what is being done in the formula above.


No, I am assuming that it is a real dot-product: the hypers are there 
because the RHS is a list of basis vectors; so the output is a list of 
magnitudes in the directions of those bases. For the UTF-challenged, I'd 
want an ascii form:


   my ($x, $y) = $vector dot ( [1, 0], [0, 1] );



Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp

Todd Olson wrote:

At 14:54 -0500 2009-12-17, Jon Lang wrote:



And really, my whole point is that the implementation details are
(conceptually) the only thing that distinguishes Complex::Polar from
Complex::Cartesian.


All though  both  e^(i ¼)  and  e^(i 3 ¼)  evaluate to -1 + 0i
it is often useful to be able to distinguish them.
So perhaps the question is do we really want Perl6 to automatically
convert e^(i 3 ¼)  to  e^(i ¼)  internally.  If not, then
we really do want some sort of access to the implementation details.


If I was implementing Complex::Polar I'd probably use an Int64 to 
represent the phase internally: we can scale it by pi/2**63 in the 
accessor. That way it automatically collapses onto one cycle.


These internal details are why I don't really like the idea of exposing 
.^attr as the mechanism by which users serialize the object. It would be 
fine to use it as the default implementation of a generic serialization 
method, but users of the object shouldn't know that.


r29364 - docs/Perl6/Spec/S32-setting-library

2009-12-17 Thread pugs-commits
Author: lwall
Date: 2009-12-18 03:57:14 +0100 (Fri, 18 Dec 2009)
New Revision: 29364

Modified:
   docs/Perl6/Spec/S32-setting-library/Containers.pod
Log:
[S32/Containers] change mutating .pick to be separate .grab method


Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod
===
--- docs/Perl6/Spec/S32-setting-library/Containers.pod  2009-12-18 00:40:13 UTC 
(rev 29363)
+++ docs/Perl6/Spec/S32-setting-library/Containers.pod  2009-12-18 02:57:14 UTC 
(rev 29364)
@@ -19,8 +19,8 @@
 
 Created: 19 Feb 2009 extracted from S29-functions.pod
 
-Last Modified: 15 Dec 2009
-Version: 11
+Last Modified: 17 Dec 2009
+Version: 12
 
 The document is a draft.
 
@@ -883,8 +883,10 @@
 
 =item pick
 
- our multi method pick ( $bag: Int $num = 1, Bool :$replace, Bool :$enums )
- our multi method pick ( $bag: Whatever, Bool :$replace, Bool :$enums )
+ our multi method pick ( $bag: Int $num = 1, Bool :$replace )
+ our multi method pick ( $bag: Whatever, Bool :$replace )
+ our multi method pickpairs ( $bag: Int $num = 1, Bool :$replace )
+ our multi method pickpairs ( $bag: Whatever, Bool :$replace )
 
 Like an ordinary list Cpick, but returns keys of the bag weighted by
 values, as if the keys were replicated the number of times indicated
@@ -896,20 +898,10 @@
 marbles out a bag.  Picking with replacement is easy to implement,
 since the weights never change, and the chance of getting any key is
 simply its replication value over C.elems.  Other forms of picking
-require tracking the temporary state, so the CBag is copied to
-a temporary private CKeyBag, and the picks are made from that.
-Picking without replacement (the default), decrements the picked
-key's replication value by one (deleting the key when it goes to 0).
-By definition, C.elems of the private CKeyBag also decreases
-by one, so the probabilities stay consistent as the pick operation
-proceeds.
+require tracking the temporary state, so the immutable CBag is copied to
+a temporary private CKeyBag, and the picks are made from that
+using the corresponding C.grab or C.grabpairs method (see below).
 
-With the C:enums option, the replication value of the picked key
-is forced immediately to 0, removing all marbles of that color from
-the bag, as it were.  Instead of returning keys, the C:enums option
-returns the picked values as a list of CEnum objects, whose keys are
-the deleted keys and whose values are the deleted replication values.
-
 Each C.pick invocation maintains its own private state and has no
 effect on subsequent C.pick invocations.
 
@@ -931,12 +923,37 @@
 value goes false.  For any CKeyHash, the C.elems methods returns
 the current sum of the values, which the CKeyHash must either track
 or compute on demand.  Tracking is preferable for efficient implementation
-of C.pick.
+of C.pick and C.grab.
 
-Since a CKeyHash, unlike a CBag, is mutable, C.pick works
-directly on the CKeyHash, modifying it in place.  You must copy
-the CKeyHash first if you don't want it modified in place.
+=over
 
+=item grab
+
+ our multi method grab ( $bag: Int $num = 1, Bool :$replace )
+ our multi method grab ( $bag: Whatever, Bool :$replace )
+ our multi method grabpairs ( $bag: Int $num = 1, Bool :$replace )
+ our multi method grabpairs ( $bag: Whatever, Bool :$replace )
+
+Like Cpick, a Cgrab returns a random selection of elements, weighted
+by the values corresponding to each key.
+Since a CKeyHash, unlike a CSet or CBag, is mutable, C.grab
+works directly on the CKeyHash, modifying it in place.  (You may use
+C.pick to treat the CKeyHash as immutable; this will copy it and grab
+only from the temporary copy.)
+
+Swiping without replacement (the default) decrements the grabbed
+key's replication value by one (deleting the key when it goes to 0).
+By definition, C.elems of the bag also decreases by one, so the
+probabilities stay consistent through subsequent grab operations.
+
+With the C.grabpairs version, the replication value of the picked
+key is forced immediately to 0, removing all marbles of that color from
+the bag, as it were.  Instead of returning keys, returns the grabbed
+values as a list of CPair objects, whose keys are the deleted keys
+and whose values are the deleted replication values.
+
+=back
+
 =head2 KeyWeight
 
 A CKeyHash of FatRat; like a CKeyBag but may have non-integral



r29365 - docs/Perl6/Spec

2009-12-17 Thread pugs-commits
Author: lwall
Date: 2009-12-18 05:05:15 +0100 (Fri, 18 Dec 2009)
New Revision: 29365

Modified:
   docs/Perl6/Spec/S04-control.pod
   docs/Perl6/Spec/S29-functions.pod
Log:
[S04] rename break/nobreak to succeed/proceed


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2009-12-18 02:57:14 UTC (rev 29364)
+++ docs/Perl6/Spec/S04-control.pod 2009-12-18 04:05:15 UTC (rev 29365)
@@ -14,7 +14,7 @@
 Created: 19 Aug 2004
 
 Last Modified: 17 Dec 2009
-Version: 92
+Version: 93
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -849,7 +849,7 @@
 The value of the inner block is returned as the value of the outer
 block.
 
-If the smart match fails, control passes to the next statement
+If the smart match fails, control proceeds the next statement
 normally, which may or may not be a Cwhen statement.  Since Cwhen
 statements are presumed to be executed in order like normal statements,
 it's not required that all the statements in a switch block be Cwhen
@@ -875,27 +875,29 @@
 of any Cwhen statements within the loop.
 
 You can explicitly break out of a Cwhen block (and its surrounding
-topicalizer block) early using the Cbreak verb.  More precisely,
+topicalizer block) early using the Csucceed verb.  More precisely,
 it first scans outward (lexically) for the innermost containing
 Cwhen block.  From there it continues to scan outward to find the
 innermost block outside the Cwhen that uses C$_ as one of its
 formal parameters, either explicitly or implicitly.  (Note that
 both of these scans are done at compile time; if the scans fail,
 it's a compile-time semantic error.)  Typically, such an outer
-block will be a Cgiven or a Cfor statement, but any block that
+block will be the block of a Cgiven or a Cfor statement, but any block that
 sets the topic in its signature can be broken out of.  At run time,
-Cbreak uses a control exception to scan up the dynamic chain to
+Csucceed uses a control exception to scan up the dynamic chain to
 find the call frame belonging to that same outer block, and
 when it has found that frame, it does a C.leave on it to unwind
-the call frames.  If any arguments are supplied to the Cbreak function,
+the call frames.  If any arguments are supplied to the Csucceed function,
 they are passed out via the Cleave method.  Since leaving a block is
-considered a successful return, breaking out of one is also considered
-a successful return.  (And in fact, the implicit break of a normal
+considered a successful return, breaking out of one with Csucceed is also 
considered
+a successful return for the purposes of CKEEP and CUNDO.
+
+The implicit break of a normal
 Cwhen block works the same way, returning the value of the entire
-block (normally from its last statement) via an implicit C.leave.)
+block (normally from its last statement) via an implicit Csucceed.
 
 You can explicitly leave a Cwhen block and go to the next statement
-following the Cwhen by using Cnobreak.  (Note that, unlike C's
+following the Cwhen by using Cproceed.  (Note that, unlike C's
 idea of falling through, subsequent Cwhen conditions are evaluated.
 To jump into the next Cwhen block without testing its condition,
 you must use a Cgoto.  But generally that means you should refactor
@@ -908,15 +910,16 @@
 (or some more violent control exception such as Creturn) to break
 out of the entire loop early.  Of course, an explicit Cnext might
 be clearer than a Cbreak if you really want to go directly to the
-next iteration.  On the other hand, Cbreak can take an optional
+next iteration.  On the other hand, Csucceed can take an optional
 argument giving the value for that iteration of the loop.  As with
-the C.leave method, there is also a C.break method to break from a
+the C.leave method, there is also a C.succeed method to break from a
 labelled block functioning as a switch:
 
-OUTER.break($retval)
+OUTER.succeed($retval)
 
 There is a Cwhen statement modifier, but it does not have any
-break semantics.  That is,
+breakout semantics; it is merely a smartmatch against
+the current topic.  That is,
 
 doit() when 42;
 

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-12-18 02:57:14 UTC (rev 29364)
+++ docs/Perl6/Spec/S29-functions.pod   2009-12-18 04:05:15 UTC (rev 29365)
@@ -953,8 +953,8 @@
 
 =item Flow control
 
-break
-continue
+succeed
+proceed
 redo
 
 =item Other



r29366 - in docs/Perl6/Spec: . S32-setting-library

2009-12-17 Thread pugs-commits
Author: lwall
Date: 2009-12-18 05:28:09 +0100 (Fri, 18 Dec 2009)
New Revision: 29366

Modified:
   docs/Perl6/Spec/S03-operators.pod
   docs/Perl6/Spec/S12-objects.pod
   docs/Perl6/Spec/S32-setting-library/Basics.pod
Log:
[S03] rename prefix:true to prefix:so to avoid having to explain the
valence difference between 'true' and 'True', and to make truth slightly
shorter than falsity in a huffmanly sort of way.


Modified: docs/Perl6/Spec/S03-operators.pod
===
--- docs/Perl6/Spec/S03-operators.pod   2009-12-18 04:05:15 UTC (rev 29365)
+++ docs/Perl6/Spec/S03-operators.pod   2009-12-18 04:28:09 UTC (rev 29366)
@@ -16,7 +16,7 @@
 Created: 8 Mar 2004
 
 Last Modified: 17 Dec 2009
-Version: 182
+Version: 183
 
 =head1 Overview
 
@@ -49,7 +49,7 @@
 X  Tight or  || ^^ // min max
 R  Conditional   ?? !! ff fff
 R  Item assignment   = := ::= = += -= **= xx= .=
-L  Loose unary   true not
+L  Loose unary   so not
 X  Comma operator, p5= :
 X  List infixZ minmax X X~ X* Xeqv ...
 R  List prefix   print push say die map substr ... [+] [*] any $ @
@@ -593,7 +593,7 @@
 
 Evaluates the expression as a boolean and returns CTrue if expression
 is true or CFalse otherwise.
-See true below for a low-precedence alternative.
+See so below for a low-precedence alternative.
 
 =item *
 
@@ -1522,16 +1522,26 @@
 
 =item *
 
-C prefix:true 
+C prefix:not 
 
-true any(@args) eq '-v' | '-V'
+not any(@args) eq '-v' | '-V'
 
+Returns a CBool value representing the logical negation of an expression.
+
 =item *
 
-C prefix:not 
+C prefix:so 
 
-not any(@args) eq '-v' | '-V'
+so any(@args) eq '-v' | '-V'
 
+Returns a CBool value representing the logical non-negation of an expression.
+Mostly useful as documentation in parallel to a Cnot when Celse isn't
+appropriate:
+
+if not $x { print LOL; }
+mumble();
+if so $x { print SRSLY! }
+
 =back
 
 =head2 Comma operator precedence
@@ -2895,8 +2905,10 @@
 behavior is not desired, put the expression into item context rather
 than list context.)  This self-deletion is a behavior of the operators
 themselves, not a general property of boolean values in list context, so
+either of:
 
-@foo = true($a||$b);
+@foo = so($a||$b);
+@foo = not($a||$b);
 
 is guaranteed to insert exactly one boolean value into C@foo.
 

Modified: docs/Perl6/Spec/S12-objects.pod
===
--- docs/Perl6/Spec/S12-objects.pod 2009-12-18 04:05:15 UTC (rev 29365)
+++ docs/Perl6/Spec/S12-objects.pod 2009-12-18 04:28:09 UTC (rev 29366)
@@ -1789,9 +1789,7 @@
 compilation error.  (All colliding values are hidden, not just the new one,
 or the old one.)  Any explicit sub or type definition hides all imported
 enum keys of the same name but will produce a warning unless
-Cis redefined is included.  Note that true() is a built-in function
-and requires an argument, while CTrue is short for CBool::True and
-does not take an argument.
+Cis redefined is included.
 
 Since non-native CEnum values know their enumeration type, they may be used 
to
 name a desired property on the right side of a Cbut or Cdoes.

Modified: docs/Perl6/Spec/S32-setting-library/Basics.pod
===
--- docs/Perl6/Spec/S32-setting-library/Basics.pod  2009-12-18 04:05:15 UTC 
(rev 29365)
+++ docs/Perl6/Spec/S32-setting-library/Basics.pod  2009-12-18 04:28:09 UTC 
(rev 29366)
@@ -44,7 +44,7 @@
  our multi method undefine( $self: ) is export {...}
 
  method not() {...}
- method true() {...}
+ method so() {...}
  }
 
 =over
@@ -86,9 +86,9 @@
 
  method not() {...}
 
-=item true
+=item so
 
- method true() {...}
+ method so() {...}
 
 XXX Copied from S02 -- should it be deleted from there?