Does =$*ARGS work?

2007-04-12 Thread brian d foy
Randal and I are starting work on Learning Perl 6, and now
that I've completed a lot of other things, I can actually start
paying attention to Perl 6. Here's the first of my stupid, where
have you been for the past 2 years you moron questions. :)

I'm working on the chapter on I/O (Chapter 5 in the current Llama), 
specifically reading from the command lines files.

Under the section The for Statement in S04, it says that the diamond
operator

   while(  ) { ... } 
   
becomes in Perl 6

   for =$*ARGS { ... }
   
In the Pugs I have (6.2.13 (r15868) on Intel darwin), =$*ARGS only
reads the lines from the first file in @ARGS. I don't see this idiom
used anywhere else in the tests or examples, either.

The $*ARGS variable shows up in this file, which looks like it's still 
maintained:

   http://svn.pugscode.org/pugs/docs/AES/S28draft.pod

but that points to another variable list that it says is more
complete, although it does not list $*ARGS:

   http://svn.pugscode.org/pugs/docs/Perl6/Overview/Variable.pod

Is this something that's not yet implemented or just broken? Am I
missing some documentation about parts that aren't implemented yet?

I wrote a test to put into t/builtin/io (once I remember my password),
but since I haven't committed anything to pugs before, I want to ensure
it's not me being stupid. :)

Also, along with that, is there any counterpart to Perl 5's $ARGV? I
wanted to record the files =$*ARGS went through, but I didn't see a way
to discover that.


using sp space in character classes

2007-04-12 Thread Brad Bowman

Hello,

In S05, sp is listed under named assertions and isn't explicitly
mentioned in the section on character classes.

Can sp be used in character classes, in particular to include or
exclude space (U+0020)?  eg. space-sp,  alnum+sp

Is there another way to do this, maybe [\ ] escaping?

Thanks,

Brad

--
There are two things that will blemish a retainer, these are riches and
honor. But if one remains in strained circumstances he will not be
marred. -- Hagakure http://bereft.net/hagakure/


Re: Does =$*ARGS work?

2007-04-12 Thread Moritz Lenz
Hi,

brian d foy wrote:
 Under the section The for Statement in S04, it says that the diamond
 operator
 
while(  ) { ... } 

 becomes in Perl 6
 
for =$*ARGS { ... }

Some time ago I read that too, and wondered why that's not [EMAIL PROTECTED] 
That
seems more reasonable, because the command line arguments are stored in
@*ARGS.

I can't answer your question, sorry ;-).

Moritz

-- 
Moritz Lenz
http://moritz.faui2k3.org/ -  http://sudokugarden.de/ - http://perl-6.de/



signature.asc
Description: OpenPGP digital signature


Re: Does =$*ARGS work?

2007-04-12 Thread brian d foy
In article [EMAIL PROTECTED], Moritz Lenz
[EMAIL PROTECTED] wrote:

 Hi,
 
 brian d foy wrote:
  Under the section The for Statement in S04, it says that the diamond
  operator
  
 while(  ) { ... } 
 
  becomes in Perl 6
  
 for =$*ARGS { ... }
 
 Some time ago I read that too, and wondered why that's not [EMAIL PROTECTED] 
 That
 seems more reasonable, because the command line arguments are stored in
 @*ARGS.

well, $*ARGS is a magical filehandle, not a list of files. If you could
use an array there, I think you'd have to allow any array, and that
would be weird.


Re: Does =$*ARGS work?

2007-04-12 Thread Moritz Lenz
Hi,

brian d foy wrote:
 In article [EMAIL PROTECTED], Moritz Lenz
 [EMAIL PROTECTED] wrote:
 
 Hi,

 brian d foy wrote:
 Under the section The for Statement in S04, it says that the diamond
 operator

while(  ) { ... } 

 becomes in Perl 6

for =$*ARGS { ... }
 Some time ago I read that too, and wondered why that's not [EMAIL PROTECTED] 
 That
 seems more reasonable, because the command line arguments are stored in
 @*ARGS.
 
 well, $*ARGS is a magical filehandle, not a list of files. If you could
 use an array there, I think you'd have to allow any array, and that
 would be weird.

Why would that be weird? When things like

my $file = /etc/passwd;
for =$file - $line { ... }

work, why shouldn't we allow things like

my @files = foo bar
for [EMAIL PROTECTED] - $line { ... }

and let '=' followed by an empty list default to $*IN (like in =)?

I think that would be consequent magic, and very convenient.

(If you already had that discussion earlier, just say it and I'll shut
up ;-)

Cheers,
Moritz

-- 
Moritz Lenz
http://moritz.faui2k3.org/ -  http://sudokugarden.de/ - http://perl-6.de/



signature.asc
Description: OpenPGP digital signature


Re: Synopsis 26

2007-04-12 Thread Damian Conway

[decloak]

I have just uploaded the alpha release of Perl6::Perldoc to CPAN.
From the README:

Perl6::Perldoc version 0.0.2

This distribution provides modules and applications that allow you
to use the Pod dialect of the new Perl 6 documentation markup
language Perldoc.

* The Perl6::Perldoc module allows you to document Perl 5 code
  with Perl 6 markup.

* The Perl6::Perldoc::Parser module converts the markup into a
  OO parse tree.

* The Perl6::Perldoc::To:Text module augments the OO parse tree
  with to_text() methods, to facilitate Perldoc-to-text
  conversion. The perldoc2text application provides a command-
  line front-end for this module.

* The Perl6::Perldoc::To:Xhtml module augments the OO parse tree
  with to_xhtml() methods, to facilitate Perldoc-to-XHTML
  conversion. The perldoc2xhtml application provides a command-
  line front-end for this module.

The distribution also includes a rudimentary test suite, as well as the latest 
update of S26.pod6, so you have a solid 2200-line example file to try the new 
modules on.


Thanks for your patience.

Damian

[recloak]


Re: Synopsis 26

2007-04-12 Thread Ævar Arnfjörð Bjarmason

On 4/12/07, Damian Conway [EMAIL PROTECTED] wrote:

C our $BALANCED_BRACKETS = ..  on line 22 in Parser.pm needs to be
C our $BALANCED_BRACKETS; $BALANCED_BRACKETS = ...  or almost all
the tests have compile errors on my 5.8.8.

With that fix a lot of tests still fail, here's a full report:
http://sial.org/pbot/24167


Re: Synopsis 26

2007-04-12 Thread Ævar Arnfjörð Bjarmason

On 4/12/07, Ævar Arnfjörð Bjarmason [EMAIL PROTECTED] wrote:

With that fix a lot of tests still fail, here's a full report:
http://sial.org/pbot/24167


I updated to YAML::Syck 0.84 which made different parts of the test
suite fail, see http://sial.org/pbot/24168


Re: using sp space in character classes

2007-04-12 Thread Larry Wall
On Thu, Apr 12, 2007 at 06:20:45PM +1000, Brad Bowman wrote:
: Hello,
: 
: In S05, sp is listed under named assertions and isn't explicitly
: mentioned in the section on character classes.
: 
: Can sp be used in character classes, in particular to include or
: exclude space (U+0020)?  eg. space-sp,  alnum+sp

Yes, but so far PCR only recognizes things that translate to [[:foo:]] or
\p{foo} within character classes.  It still needs to be generalized
to allow any subrules that can be interpreted as character classes.

: Is there another way to do this, maybe [\ ] escaping?

I believe -[\x20] works currently.

Larry


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

2007-04-12 Thread larry
Author: larry
Date: Thu Apr 12 17:11:56 2007
New Revision: 14370

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

Log:
Clarify the single-character backslash escapes, including \c control forms.
Note that \c[ is not legal to mean \c[ESCAPE]


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Apr 12 17:11:56 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall [EMAIL PROTECTED]
   Date: 10 Aug 2004
-  Last Modified: 16 Mar 2007
+  Last Modified: 12 Apr 2007
   Number: 2
-  Version: 100
+  Version: 101
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -2274,7 +2274,15 @@
 
 Backslash sequences still interpolate, but there's no longer any C\v
 to mean Ivertical tab, whatever that is...  (C\v now match vertical
-whitespace in a regex.)
+whitespace in a regex.)  Literal character representations are:
+
+\a  BELL
+\b  BACKSPACE
+\t  TAB
+\n  LINE FEED
+\f  FORM FEED
+\r  CARRIAGE RETURN
+\e  ESCAPE
 
 =item *
 
@@ -2302,6 +2310,22 @@
 
 [Note: none of the official Unicode character names contains comma.]
 
+(Within a regex you may also use C\C to match a character that is
+not the specified character.)
+
+If the character following C\c or C\C is not a left square bracket,
+the single following character is turned into a control character by
+the usual trick of XORing the 64 bit.  This allows C\c@ for NULL
+and C\c? for DELETE, but note that the ESCAPE character may not be
+represented that way; it must be represented something like:
+
+\e
+\c[ESCAPE]
+\x1B
+\o33
+
+Obviously C\e is preferred when brevity is needed.
+
 =item *
 
 There are no barewords in Perl 6.  An undeclared bare identifier will


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

2007-04-12 Thread larry
Author: larry
Date: Thu Apr 12 17:20:55 2007
New Revision: 14371

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

Log:
typo


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Apr 12 17:20:55 2007
@@ -2273,7 +2273,7 @@
 =item *
 
 Backslash sequences still interpolate, but there's no longer any C\v
-to mean Ivertical tab, whatever that is...  (C\v now match vertical
+to mean Ivertical tab, whatever that is...  (C\v now matches vertical
 whitespace in a regex.)  Literal character representations are:
 
 \a  BELL