Which brackets should @a.perl use?

2009-01-03 Thread Markus Laker
This behaviour looks wrong to me:


m...@edward:~/perl/6$ cat ap1
#!/home/msl/bin/perl6

my @a = blue light hazard;
my $p = @a.perl;
say \...@a: {...@a.elems} elements: $p;
say '@a[0]: ', @a[0];

my @b = eval $p;
say \...@b: {...@b.elems} elements: $p;
say '@b[0]: ',@b[0];
say '@b[0][0]: ', @b[0][0];

m...@edward:~/perl/6$ ./ap1
@a: 3 elements: [blue, light, hazard]
@a[0]: blue
@b: 1 elements: [blue, light, hazard]
@b[0]: blue light hazard
@b[0][0]: blue
m...@edward:~/perl/6$ perl6 -v
This is Rakudo Perl 6, revision 34744 built on parrot 0.8.2-devel
for i486-linux-gnu-thread-multi.

Copyright 2006-2008, The Perl Foundation.

m...@edward:~/perl/6$


Because C@a.perl returns a string surrounded in square brackets, rather
than round brackets, Ceval produces a list containing a single element:
we get one extra, unwanted level of indirection.

If C@a.perl were to return a string surrounded in round brackets, this
problem would be solved:


m...@edward:~/perl/6$ cat ap2
#!/home/msl/bin/perl6

my $p = '(blue, light, hazard)';

my @c = eval $p;
say \...@c: {...@c.elems} elements: , @c.perl;
say '@c[0]: ', @c[0];

my $c = eval $p;
say \$c: {$c.elems} elements: , $c.perl;
say '$c[0]: ', $c[0];

m...@edward:~/perl/6$ ./ap2
@c: 3 elements: [blue, light, hazard]
@c[0]: blue
$c: 3 elements: [blue, light, hazard]
$c[0]: blue
m...@edward:~/perl/6$


Is Rakudo's behaviour correct here?

Markus


r24752 - docs/Perl6/Spec

2009-01-03 Thread pugs-commits
Author: particle
Date: 2009-01-04 03:26:39 +0100 (Sun, 04 Jan 2009)
New Revision: 24752

Modified:
   docs/Perl6/Spec/S19-commandline.pod
Log:
[S19] get rid of illustration grammar, it's in the revision history if i need 
it later.

Modified: docs/Perl6/Spec/S19-commandline.pod
===
--- docs/Perl6/Spec/S19-commandline.pod 2009-01-03 23:27:16 UTC (rev 24751)
+++ docs/Perl6/Spec/S19-commandline.pod 2009-01-04 02:26:39 UTC (rev 24752)
@@ -14,8 +14,8 @@
 
   Maintainer: Jerry Gay jerry@rakudoconsulting.com
   Date: 12 Dec 2008
-  Last Modified: 2 Jan 2009
-  Version: 8
+  Last Modified: 3 Jan 2009
+  Version: 9
 
 This is a draft document. This document describes the command line interface.
 It has changed extensively from previous versions of Perl in order to increase
@@ -205,50 +205,6 @@
 =back
 
 
-These rules have been quantified in the following grammar, used solely for
-illustration purposes (this is *not* how options will be parsed by any shell).
-
-{{TODO update to current, move to non-published helper doc}}
-
-  grammar CommandLineArguments;
-
-  rule TOP {
-  argument*
-  '--'?
-  $rest=[.*]?
-  [ $ || panic: 'Syntax error' ]
-  }
-
-  rule argument { [ option | passthru | value ] {*} }
-
-  token option {
-  [
-[
-  $sym=[ '--' | '-' | ':' ]
-  $neg=[ '/' ]?
-  name
-]
-[ '=' value [ ',' value ]* ]?
-  ]
-  }
-
-  regex passthru {
-  '++' indicator .ws
-  $data=[.*?]
-  [ '--' $indicator || $ ]
-  }
-
-  token indicator { name [ '=' target=name ]? }
-
-  token name { .ident [ '-' .ident ]* }
-
-  token value {
-  | (\w+)
-  | \' (-[\']*) \'
-  | \ (-[\]*) \
-  }
-
-
 =head1 Option Categories
 
 Perl's command line options fall into three categories: