r27090 - docs/Perl6/Spec

2009-06-16 Thread pugs-commits
Author: ruoso
Date: 2009-06-16 18:34:27 +0200 (Tue, 16 Jun 2009)
New Revision: 27090

Modified:
   docs/Perl6/Spec/S11-modules.pod
Log:
[spec/S11] fix case typo

Modified: docs/Perl6/Spec/S11-modules.pod
===
--- docs/Perl6/Spec/S11-modules.pod 2009-06-16 12:37:54 UTC (rev 27089)
+++ docs/Perl6/Spec/S11-modules.pod 2009-06-16 16:34:27 UTC (rev 27090)
@@ -171,7 +171,7 @@
 to import):
 
 need ACME::Rocket;
-my $r = ACME::ROCKET.new;
+my $r = ACME::Rocket.new;
 
 This declaration is equivalent to Perl 5's:
 



Re: Why pass by reference?

2009-06-16 Thread TSa

HaloO,

Matthew Walton wrote:

If a user of your API contrives to make it change while you're
running, that's their own foot they've just shot, because they can
look at the signature and know the semantics of the parameter passing
being used and know that if they change the value externally before
you return Bad Things Could Happen.


I agree that the caller is responsible for the constness of the value
he gives to a function. With this we get the best performance. I don't
understand why John thinks that an intermediate proxy is needed. A very
shallow wrapper that ensures the readonlyness suffices. Most of the
time not even that when the constness is known statically.


Regards TSa.
--

The unavoidable price of reliability is simplicity -- C.A.R. Hoare
Simplicity does not precede complexity, but follows it. -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan


r27091 - docs/Perl6/Spec

2009-06-16 Thread pugs-commits
Author: lwall
Date: 2009-06-16 19:56:45 +0200 (Tue, 16 Jun 2009)
New Revision: 27091

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
[S04] require temp semantics for topical statement modifiers


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2009-06-16 16:34:27 UTC (rev 27090)
+++ docs/Perl6/Spec/S04-control.pod 2009-06-16 17:56:45 UTC (rev 27091)
@@ -12,8 +12,8 @@
 
   Maintainer: Larry Wall la...@wall.org
   Date: 19 Aug 2004
-  Last Modified: 29 May 2009
-  Version: 79
+  Last Modified: 16 Jun 2009
+  Version: 80
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -495,12 +495,25 @@
 
 so you can modify the current list element in that case.
 
-When used as statement modifiers, Cfor and Cgiven use a private
-instance of C$_ for the left side of the statement.  The outer C$_
-can be referred to as C$OUTER::_.  (And yes, this implies that the
-compiler may have to retroactively change the binding of C$_ on the
-left side.  But it's what people expect of a pronoun like it.)
+When used as statement modifiers on implicit blocks (thunks), Cfor
+and Cgiven privately temporize the current value of C$_ for the
+left side of the statement and restore the original value at loop exit:
 
+$_ = 42;
+.say # 42
+.say for 1,2,3;  # 1,2,3
+.say;# 42
+
+The previous value of C$_ is not available within the loop.  If you
+want it to be available, you must rewrite it as an explicit block
+using curlies:
+
+{ say OUTER::$_, $_ } for 1,2,3;  # 421,422,423
+
+No temporization is necessary with the explicit form since C$_ is a
+formal parameter to the block.  Likewise, temporization is never needed
+for C statement_control:for  because it always calls a closure.
+
 =head2 The do-once loop
 
 In PerlĀ 5, a bare block is deemed to be a do-once loop.  In PerlĀ 6,
@@ -586,7 +599,7 @@
 # Syntax error: Statement-level placeholder block
 { say $^x };
 
-# Not an syntax error, though $x doesn't get the argument it wants
+# Not a syntax error, though $x doesn't get the argument it wants
 do { say $^x };
 
 # Not an error: Equivalent to for 1..10 - $x { say $x }



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

2009-06-16 Thread pugs-commits
Author: moritz
Date: 2009-06-16 22:13:57 +0200 (Tue, 16 Jun 2009)
New Revision: 27095

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] document Str.encode

also changed order of arguments in .bytes

Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-06-16 19:52:50 UTC (rev 
27094)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-06-16 20:13:57 UTC (rev 
27095)
@@ -224,7 +224,7 @@
 
 =item bytes
 
- our Int multi method bytes ( Str $string: $nf = $?NF, $enc = $?ENC) is export
+ our Int multi method bytes ( Str $string: $enc = $?ENC, :$nf = $?NF) is export
 
 Returns the number of bytes in the string if it were encoded in the
 specified way.  Note the inequality:
@@ -236,6 +236,13 @@
 
 .bytes(C,UTF-32) * 4 == .codes(C)
 
+=item encode
+
+our Buf multi method encode($encoding = 'UTF-8', $nf = $?NF)
+
+Returns a CBuf which represents the original string in the given encoding
+and normal form.
+
 =item index
 
  our StrPos multi method index( Str $string: Str $substring, StrPos $pos = 
StrPos(0) ) is export



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

2009-06-16 Thread pugs-commits
Author: moritz
Date: 2009-06-16 22:25:26 +0200 (Tue, 16 Jun 2009)
New Revision: 27096

Modified:
   docs/Perl6/Spec/S32-setting-library/Containers.pod
Log:
[S32/Containers] flesh out Buf constructor

Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod
===
--- docs/Perl6/Spec/S32-setting-library/Containers.pod  2009-06-16 20:13:57 UTC 
(rev 27095)
+++ docs/Perl6/Spec/S32-setting-library/Containers.pod  2009-06-16 20:25:26 UTC 
(rev 27096)
@@ -736,8 +736,23 @@
 class Buf does Positional {...}
 
 A mutable container for an array of integer values in contiguous
-memory.
+memory. The default constructor takes a slurpy array parameter of
+integers, the largest of which determines the actual type. So
 
+Buf.new(:16c3, :16B6) # or
+Buf.new(195, 182) # which is exactly the same
+
+returns a Cbuf8 containing two Cuint8 items, while
+
+Buf.new(256)
+
+returns a Cbuf16 which consists of a single Cuint16.
+
+To explicit request a CBuf of a specific size, you can use
+
+Buf.new(127, :size(16)) # returns a buf16
+Buf.new(1024, :size(8)) # dies, because 1024 = 2**8
+
 =head2 Pair
 
 class Pair does Associative {...}



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

2009-06-16 Thread pugs-commits
Author: lwall
Date: 2009-06-16 22:32:37 +0200 (Tue, 16 Jun 2009)
New Revision: 27097

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] some fossils


Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-06-16 20:25:26 UTC (rev 
27096)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-06-16 20:32:37 UTC (rev 
27097)
@@ -229,16 +229,16 @@
 Returns the number of bytes in the string if it were encoded in the
 specified way.  Note the inequality:
 
-.bytes(C,UTF-16) * 2 = .codes(C)
+.bytes(UTF-16,C) * 2 = .codes(C)
 
 This is caused by the possibility of surrogate pairs, which are counted as one
 codepoint.  However, this problem does not arise for UTF-32:
 
-.bytes(C,UTF-32) * 4 == .codes(C)
+.bytes(UTF-32,C) * 4 == .codes(C)
 
 =item encode
 
-our Buf multi method encode($encoding = 'UTF-8', $nf = $?NF)
+our Buf multi method encode($encoding = $?ENC, $nf = $?NF)
 
 Returns a CBuf which represents the original string in the given encoding
 and normal form.



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

2009-06-16 Thread pugs-commits
Author: lwall
Date: 2009-06-16 22:37:03 +0200 (Tue, 16 Jun 2009)
New Revision: 27098

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] old thinko on the inequalities


Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-06-16 20:32:37 UTC (rev 
27097)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-06-16 20:37:03 UTC (rev 
27098)
@@ -229,12 +229,12 @@
 Returns the number of bytes in the string if it were encoded in the
 specified way.  Note the inequality:
 
-.bytes(UTF-16,C) * 2 = .codes(C)
+.bytes(UTF-16,C) = .codes(C) * 2
 
 This is caused by the possibility of surrogate pairs, which are counted as one
 codepoint.  However, this problem does not arise for UTF-32:
 
-.bytes(UTF-32,C) * 4 == .codes(C)
+.bytes(UTF-32,C) == .codes(C) * 4
 
 =item encode
 



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

2009-06-16 Thread pugs-commits
Author: moritz
Date: 2009-06-16 22:56:05 +0200 (Tue, 16 Jun 2009)
New Revision: 27100

Modified:
   docs/Perl6/Spec/S32-setting-library/Containers.pod
Log:
[S32/Containers] spec Buf.decode

Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod
===
--- docs/Perl6/Spec/S32-setting-library/Containers.pod  2009-06-16 20:51:36 UTC 
(rev 27099)
+++ docs/Perl6/Spec/S32-setting-library/Containers.pod  2009-06-16 20:56:05 UTC 
(rev 27100)
@@ -753,6 +753,14 @@
 Buf.new(127, :size(16)) # returns a buf16
 Buf.new(1024, :size(8)) # dies, because 1024 = 2**8
 
+=head3 Methods
+
+=item decode
+
+our Str method decode($encoding = $?ENC, $nf = $?NF)
+
+Decode the CBuf into a CStr
+
 =head2 Pair
 
 class Pair does Associative {...}



Parrot 1.3.0 Andean Swift released

2009-06-16 Thread Andrew Whitworth
On behalf of the Parrot team, I'm proud to announce Parrot 1.3.0
Andean Swift. Parrot (http://parrot.org/) is a virtual machine aimed
at running all dynamic languages.

Parrot 1.3.0 is available on Parrot's FTP site, or follow the
download instructions at http://parrot.org/download.  For those who
would like to
develop on Parrot, or help develop Parrot itself, we recommend using Subversion
on the source code repository to get the latest and best Parrot code.

Parrot 1.3.0 News:
- Core
  + Optimized parts of the IO system
  + Fixed inheritance hierarchy of FileHandle and Socket PMC types
  + Fixed leaks involving subroutines and Parrot_Context
  + Cleaned up and refactored GC internals, including fixes and optimizations
  + Optimized PMC class manipulations to use type numbers instead of
string names
  + Fixed problems involving hashval calculations in strings
  + Removed unnecessary MULTI dispatches in built-in PMCs
  + Fixed memory leaks involving PMCs that were not properly destroyed
  + Fixed creation of PMCProxy PMCs in correct namespaces
  + Added preliminary Pipe support
  + Fixed cloning of Object PMCs
  + Added root_new opcode
  + Added initial versions of Packfile PMCs with read/write capabilities
- Compilers
  + Fixed several memory leaks in IMCC
  + Updated PCT to use root_new opcode
  + Added support for keyword self in NQP
- Documentation
  + Improved and expanded /docs/book
  + Updated project documentation
  + Defined 'experimental' status and procedures in DEPRECATED.pod
- Miscellaneous
  + Cleaned code and improved code-level documentation
  + Various bugfixes, code cleanups, and coding standard fixes
  + Added an experimental compiler library to help use PIR libraries from HLLs
  + Updated OpenGL library and examples to support experimental HLL import


Many thanks to all our contributors for making this possible, and our sponsors
for supporting this project.  Our next scheduled release is 21 July 2009.

Enjoy!


--Andrew Whitworth