No such method 'prefix' for invocant of type 'Capture' when trying to patch a new library include path

2020-05-10 Thread Konrad Bucheli via perl6-users
Dear Raku experts


I have a little patch which adds another library include path and installation 
site named "foo" which points to "/opt/foo/lib", see attached patch.

That worked (in a similar fashion) well with 2020.02, but with 2020.05 it fails 
on the following test:


$ cat foo.rakumod
unit module foo;
use Test;
$ raku -I . -e "use foo"
===SORRY!=== Error while compiling -e
===SORRY!=== Error while compiling /home/kb/foo.rakumod (foo)
No such method 'prefix' for invocant of type 'Capture'
at /home/kb/foo.rakumod (foo):2

at -e:1
$


Interestingly it works fine after the second or third time, and then always, 
until I remove the ~/.raku and .precomp directories...

Maybe it is fine when it somehow managed to get precompiled. And without this 
little innocent patch it is also working.

Can someone enlighten me?

Cheers

Konrad
diff --git a/src/core.c/CompUnit/RepositoryRegistry.pm6 b/src/core.c/CompUnit/RepositoryRegistry.pm6
index 84250e72e..26274464e 100644
--- a/src/core.c/CompUnit/RepositoryRegistry.pm6
+++ b/src/core.c/CompUnit/RepositoryRegistry.pm6
@@ -136,6 +136,7 @@ class CompUnit::RepositoryRegistry {
 my str $core   = 'inst#' ~ $prefix ~ $sep ~ 'core';
 my str $vendor = 'inst#' ~ $prefix ~ $sep ~ 'vendor';
 my str $site   = 'inst#' ~ $prefix ~ $sep ~ 'site';
+my str $foo= 'inst#' ~ '/opt/foo/lib';
 
 my str $home;
 my str $home-spec;
@@ -182,6 +183,17 @@ class CompUnit::RepositoryRegistry {
   )
 ) unless nqp::existskey($unique, $site);
 
+# FOO specific: /opt/foo/lib
+nqp::bindkey($custom-lib, 'foo',
+  $next-repo := self!register-repository(
+$foo,
+CompUnit::Repository::Installation.new(
+  :prefix('/opt/foo/lib'),
+  :$next-repo
+)
+  )
+) unless nqp::existskey($unique, $foo);
+
 nqp::bindkey($custom-lib,'home',
   $next-repo := self!register-repository(
 $home-spec,
@@ -215,6 +227,11 @@ class CompUnit::RepositoryRegistry {
 my \repo := nqp::atkey($repos,$site);
 nqp::bindkey($custom-lib,'site',repo) if repo;
 }
+# FOO specific: /opt/foo/lib
+unless nqp::existskey($custom-lib, 'foo') {
+my \repo := nqp::atkey($repos, $foo);
+nqp::bindkey($custom-lib, 'foo', \repo) if repo;
+}
 unless nqp::existskey($custom-lib,'home') {
 if $home-spec {
 my \repo := nqp::atkey($repos,$home-spec);


Re: [PATCH] multiple heredoc beginning in the same line

2016-12-02 Thread Perl6
it's not so difficult, really. you just gotta know the trick:

- cd into the repository you want, then run "git am".
- Use your mail client's "view source" function (ctrl-u in thunderbird
for example).
- copy the complete mail source including headers
- paste it into the terminal that's running git am
- hit return if necessary, and ctrl-d

done.

I pushed the patch to our repository. Thanks for your work, francois!
  - Timo


Re: [PATCH] multiple heredoc beginning in the same line

2016-12-02 Thread franc...@avalenn.eu
On Thu, Dec 01, 2016 at 10:46:17AM -0600, andy_b...@wiwb.uscourts.gov wrote:
> Hmm:
> $ cat /tmp/here.pl6
> my ($first, $second) = qq:to/END1/, qq:to/END2/;
>   FIRST
>   MULTILINE
>   STRING
>   END1
>SECOND
>MULTILINE
>STRING
>END2
> say "f: $first, s: $second";
> 
> $ perl6 /tmp/here.pl6
> f: FIRST
> MULTILINE
> STRING
> , s: SECOND
> MULTILINE
> STRING
> 
> 
> I'd expected $second to have both strings, as its here doc seems to start 
> at "FIRST" and go to END2 ... or am I misreading this?

Freely rephrasing POSIX[1] to adapt it to Perl6 the description could
be :

The first here-document begins after the next  and
continues until there is a line containing only the delimiter
(possibly preceded by spaces) followed immediately by a ,
Then the next here-document starts, if there is one.

So it is expected that $second does not include $first.

[1]: 
http://pubs.opengroup.org/onlinepubs/007904875/utilities/xcu_chap02.html#tag_02_07_04


Re: [PATCH] multiple heredoc beginning in the same line

2016-12-02 Thread franc...@avalenn.eu
On Thu, Dec 01, 2016 at 10:15:03AM -0500, Will Coleda wrote:
> This will be much more likely to be applied if you provide a pull
> request to the repo at https://github.com/perl6/doc

I agree but it was a lot simpler for me to send it by e-mail at the moment.
I will perhaps try to make a pull-request when I have time and access
at the same time.


Re: [PATCH] multiple heredoc beginning in the same line

2016-12-01 Thread Will Coleda
This will be much more likely to be applied if you provide a pull
request to the repo at https://github.com/perl6/doc

On Wed, Nov 30, 2016 at 10:31 AM,   wrote:
> This is to document the fact that, as in POSIX shell, you can use
> multiple HEREDOC strings in the same line.
>
> ---
>  doc/Language/quoting.pod6 | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/doc/Language/quoting.pod6 b/doc/Language/quoting.pod6
> index f7fe658..393807b 100644
> --- a/doc/Language/quoting.pod6
> +++ b/doc/Language/quoting.pod6
> @@ -386,6 +386,20 @@ would produce:
>file "db.7.3.8";
>};
>
> +You can begin multiple Heredocs in the same line.
> +
> +=begin code
> +my ($first, $second) = qq:to/END1/, qq:to/END2/;
> +  FIRST
> +  MULTILINE
> +  STRING
> +  END1
> +   SECOND
> +   MULTILINE
> +   STRING
> +   END2
> +=end code
> +
>  =head1 Regexes
>
>  For information about quoting as applied in regexes see the L --
> 2.9.3



-- 
Will "Coke" Coleda


[PATCH] multiple heredoc beginning in the same line

2016-11-30 Thread francois
This is to document the fact that, as in POSIX shell, you can use
multiple HEREDOC strings in the same line.

---
 doc/Language/quoting.pod6 | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/doc/Language/quoting.pod6 b/doc/Language/quoting.pod6
index f7fe658..393807b 100644
--- a/doc/Language/quoting.pod6
+++ b/doc/Language/quoting.pod6
@@ -386,6 +386,20 @@ would produce:
   file "db.7.3.8";
   };
 
+You can begin multiple Heredocs in the same line.
+
+=begin code
+my ($first, $second) = qq:to/END1/, qq:to/END2/;
+  FIRST
+  MULTILINE
+  STRING
+  END1
+   SECOND
+   MULTILINE
+   STRING
+   END2
+=end code
+
 =head1 Regexes
 
 For information about quoting as applied in regexes see the L

[perl #127172] [PATCH] Support for auto-generating private accessors.

2016-05-10 Thread Will Coleda via RT
Sorry for the delay in responding.

This patch no long applies cleanly (though much of it does). If you would still 
like to pursue this issue, please submit a PR to the rakudo github project, 
which will make it easier to review and apply.


-- 
Will "Coke" Coleda


[perl #125542] [PATCH] Warn on P5ish use of \ on single sigiled variable

2016-05-10 Thread Will Coleda via RT

Sorry for the delay in responding.

This patch no long applies cleanly. If you would still like to pursue this 
issue, please submit a PR to the rakudo github project, which will make it 
easier to review and apply.


-- 
Will "Coke" Coleda


[perl #124104] [PATCH] dealing with degenerate case for polymod.

2016-05-10 Thread Will Coleda via RT
Sorry for the delay in responding.

This patch no long applies cleanly. If you would still like to pursue this 
issue, please submit a PR to the rakudo github project, which will make it 
easier to review and apply.



-- 
Will "Coke" Coleda


[perl #123678] [PATCH] Use TAP::Harness for t/harness instead of Test::Harness

2016-04-26 Thread Will Coleda via RT
On Sat Aug 29 12:21:47 2015, coke wrote:
> On Mon Jan 26 15:02:24 2015, flusse...@gmail.com wrote:
> > Hi,
> >
> > I saw some LHF in the test harness code and had a go at improving it.
> > Doesn't add noticeable spectest speedups, sorry (just prettier code
> > :)
> 
> Apologies for the delay in replying. Pull requests to github get
> -slightly- better turnaround time.
> 
> TAP::Harness was introduced in 5.10.1 - I'm pretty sure our current
> perl5 build requirement is 5.10.0 - I'm not sure if we are ready to
> bump that up.
> 
> Additionally, this patch no cleanly applies.

It got worse, t/harness no longer exists, after a recent commit.

If you'd like to pursue this, please provide a pull request against 
rakudo/rakudo on github against the new t/harness5

-- 
Will "Coke" Coleda


[perl #127847] [PATCH] Bug #126800

2016-04-10 Thread Christian Bartolomaeus via RT
On Sun Apr 10 14:01:06 2016, alex.jakime...@gmail.com wrote:
> This can be closed. See https://github.com/rakudo/rakudo/pull/737

Thanks. I'm closing this ticket as 'resolved'.


Re: [perl #127847] [PATCH] Bug #126800

2016-04-08 Thread Elizabeth Mattijsen

> On 06 Apr 2016, at 22:47, Bernhard Specht (via RT) 
> <perl6-bugs-follo...@perl.org> wrote:
> 
> # New Ticket Created by  Bernhard Specht 
> # Please include the string:  [perl #127847]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=127847 >
> 
> 
> disallow dimensions smaller or equal 0 in shapes
> <0001-disallow-dimensions-smaller-or-equal-0-in-shapes.patch>

Thank you for your suggestion.

It would make life a lot easier if you could turn this into a rakudo Pull 
Request.


Having said that, I have a few remarks about your patch:

+my class X::IllegalDimensionInShape is Exception {
+has $.dim;
+method message() {
+"Illegal dimension in shape: $.dim. All dimensions must be integers 
bigger than 0"
+}
+}
+

Creating a new exception class: good!

@@ -399,11 +400,12 @@ my class Rakudo::Internals {
 my $key := nqp::list(meta-obj);
 my $dims := nqp::list_i();
 for @dims {
-if nqp::istype($_, Whatever) {
-X::NYI.new(feature => 'Jagged array shapes');
+my $dim = $_.Int;
+if $dim <= 0 {
+X::IllegalDimensionInShape.new(dim => $dim).throw;
 }
 nqp::push($key, type-key);
-nqp::push_i($dims, $_.Int);
+nqp::push_i($dims, $dim);

You have to seem to have lost the check on Whatever here ??


-my $succ-nchrs = 
'123456789BCDEFGHIJKLMNOPQRSTUVWXYZbcdefghijklmnopqrstuvwxyzΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψωבגדהוזחטיךכלםמןנסעףפץצקרשתБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯбвгдежзийклмнопрстуфхцчшщъыьэюя١٢٣٤٥٦٧٨٩१२३४५६७८९১২৩৪৫৬৭৮৯੧੨੩੪੫੬੭੮੯૧૨૩૪૫૬૭૮૯୧୨୩୪୫୬୭୮୯ⁱ⁲⁳⁴⁵⁶⁷⁸⁹₁₂₃₄₅₆₇₈₉ⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻ②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵▂▃▄▅▆▇█⚁⚂⚃⚄⚅❷❸❹❺❻❼❽❾❿123456789';
 
+my $succ-nchrs = 
'123456789BCDEFGHIJKLMNOPQRSTUVWXYZbcdefghijklmnopqrstuvwxyzΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψωבגדהוזחטיךכלםמןנסעףפץצקרשתБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯбвгдежзийклмнопрстуфхцчшщъыьэюя١٢٣٤٥٦٧٨٩१२३४५६७८९১২৩৪৫৬৭৮৯੧੨੩੪੫੬੭੮੯૧૨૩૪૫૬૭૮૯୧୨୩୪୫୬୭୮୯ⁱ⁲⁳⁴⁵⁶⁷⁸⁹₁₂₃₄₅₆₇₈₉ⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻ②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵▂▃▄▅▆▇█⚁⚂⚃⚄⚅❷❸❹❺❻❼❽❾❿123456789';

Not sure what the difference is here.  Doesn’t seem to pertain to the issue.

In any case, if anything should happen in these lines, it should be done in the 
generator script.



Liz

[perl #127847] [PATCH] Bug #126800

2016-04-08 Thread via RT
# New Ticket Created by  Bernhard Specht 
# Please include the string:  [perl #127847]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=127847 >


disallow dimensions smaller or equal 0 in shapes
From 93c5f8a96d7f8f31040d22e3e4e1ad989d52cdd9 Mon Sep 17 00:00:00 2001
From: bspecht <bernh...@specht.net>
Date: Wed, 6 Apr 2016 22:36:24 +0200
Subject: [PATCH] disallow dimensions smaller or equal 0 in shapes

---
 src/core/Exception.pm|  9 -
 src/core/Rakudo/Internals.pm | 14 --
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/core/Exception.pm b/src/core/Exception.pm
index cb90544..2d8b4c8 100644
--- a/src/core/Exception.pm
+++ b/src/core/Exception.pm
@@ -2252,7 +2252,7 @@ my class X::PhaserExceptions is Exception {
 }
 
 nqp::bindcurhllsym('P6EX', nqp::hash(
-  'X::TypeCheck::Binding', 
+  'X::TypeCheck::Binding',
   sub (Mu $got, Mu $expected, $symbol?) {
   X::TypeCheck::Binding.new(:$got, :$expected, :$symbol).throw;
   },
@@ -2444,6 +2444,13 @@ my class X::TooManyDimensions is Exception {
 }
 }
 
+my class X::IllegalDimensionInShape is Exception {
+has $.dim;
+method message() {
+"Illegal dimension in shape: $.dim. All dimensions must be integers 
bigger than 0"
+}
+}
+
 my class X::Assignment::ArrayShapeMismatch is Exception {
 has $.target-shape;
 has $.source-shape;
diff --git a/src/core/Rakudo/Internals.pm b/src/core/Rakudo/Internals.pm
index c66bbe3..76605f4 100644
--- a/src/core/Rakudo/Internals.pm
+++ b/src/core/Rakudo/Internals.pm
@@ -6,6 +6,7 @@ my class X::Assignment::ToShaped { ... };
 my class X::Str::Sprintf::Directives::BadType { ... };
 my class X::Str::Sprintf::Directives::Count { ... };
 my class X::Str::Sprintf::Directives::Unsupported { ... };
+my class X::IllegalDimensionInShape { ... };
 
 my class Rakudo::Internals {
 
@@ -399,11 +400,12 @@ my class Rakudo::Internals {
 my $key := nqp::list(meta-obj);
 my $dims := nqp::list_i();
 for @dims {
-if nqp::istype($_, Whatever) {
-X::NYI.new(feature => 'Jagged array shapes');
+my $dim = $_.Int;
+if $dim <= 0 {
+X::IllegalDimensionInShape.new(dim => $dim).throw;
 }
 nqp::push($key, type-key);
-nqp::push_i($dims, $_.Int);
+nqp::push_i($dims, $dim);
 }
 my $storage := nqp::create(nqp::parameterizetype(SHAPE-STORAGE-ROOT, 
$key));
 nqp::setdimensions($storage, $dims);
@@ -780,7 +782,7 @@ my class Rakudo::Internals {
 method get-local-timezone-offset() {
 my $utc = time;
 my Mu $fia := nqp::p6decodelocaltime(nqp::unbox_i($utc));
-
+
 DateTime.new(
   :year(nqp::atpos_i($fia,5)),
   :month(nqp::atpos_i($fia,4)),
@@ -1209,7 +1211,7 @@ my class Rakudo::Internals {
 
 # normal increment magic chars & incremented char at same index
 my $succ-nlook = 
'012345678ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟÎ
 Î¡Î£Î¤Î¥Î¦Î§Î¨Î±Î²Î³Î´ÎµÎ¶Î·Î¸Î¹ÎºÎ»Î¼Î½Î¾Î¿Ï€ÏÏƒÏ„Ï…
φχψאבגדהוזחטיךכלםמןנ
סעףפץצקרשАБВГДЕЖЗИЙКЛМНОПР
СТУФХЦЧШЩЪЫЬЭЮабвгдежзийклмнопрстуфх
цчшщъыьэю٠
١٢٣٤٥٦٧٨०१२३४५६७८০১২৩৪৫৬৭৮੦੧੨੩੪੫੬੭੮૦૧૨૩૪૫૬૭૮୦୧୨୩୪୫୬୭୮⁰ⁱ⁲⁳⁴⁵⁶⁷⁸₀₁₂₃₄â‚
…₆₇₈ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺ①
②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄â’
…⒆⒜⒝⒞⒟⒠
⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴▁▂▃▄▅
▆▇⚀⚁⚂⚃⚄❶❷❸❹❺❻❼❽❾012345678🍺🐪';
-my $succ-nchrs = 
'123456789BCDEFGHIJKLMNOPQRSTUVWXYZbcdefghijklmnopqrstuvwxyzΒΓΔΕΖΗΘΙΚΛΜΝΞΟÎ
 Î¡Î£Î¤Î¥Î¦Î§Î¨Î©Î²Î³Î´ÎµÎ¶Î·Î¸Î¹ÎºÎ»Î¼Î½Î¾Î¿Ï€ÏÏƒÏ„Ï…
φχψωבגדהוזחטיךכלםמןנ
סעףפץצקרשתБВГДЕЖЗИЙКЛМНОПР
СТУФХЦЧШЩЪЫЬЭЮЯбвгдежзийклмнопрстуфх
цчшщъыьэюя١٢٣٤٥٦٧٨٩१२३४५६७८९১২৩৪৫৬৭৮৯੧੨੩੪੫੬੭੮੯૧૨૩૪૫૬૭૮૯୧୨୩୪୫୬୭୮୯ⁱ⁲⁳⁴⁵⁶⁷⁸⁹₁₂₃₄â‚
…₆₇₈₉ⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺâ…
»â‘¡â‘¢â‘£â‘¤â‘¥â‘¦â‘§â‘¨â‘©â‘ªâ‘«â‘¬â‘­â‘®â‘¯â‘°â‘±â‘²â‘³â‘µâ‘¶â‘·â‘¸â‘¹â‘ºâ‘»â‘¼â‘½â‘¾â‘¿â’€â’â’‚⒃⒄â’
…⒆⒇⒝⒞⒟⒠
⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵▂▃▄▅
▆▇█⚁⚂⚃⚄⚅
❷❸❹❺❻❼❽❾❿123456789🍻🐫'; 
+my $succ-nchrs = 
'123456789BCDEFGHIJKLMNOPQRSTUVWXYZbcdefghijklmnopqrstuvwxyzΒΓΔΕΖΗΘΙΚΛΜΝ

[perl #127126] [PATCH] Decent sqrt() - makes sqrt(-1+0i) == i

2016-01-09 Thread Christian Bartolomaeus via RT
On Sat Jan 02 15:19:11 2016, elizabeth wrote:
> > On 02 Jan 2016, at 20:54, Dan Kogai (via RT)  > follo...@perl.org> wrote:
> >
> > # New Ticket Created by  Dan Kogai
> > # Please include the string:  [perl #127126]
> > # in the subject line of all future correspondence about this issue.
> > # https://rt.perl.org/Ticket/Display.html?id=127126 >
> >
> >
> > Oops, the previous message does not contain the patch so I am
> > submitting again.  Use the patch below or just pull
> > https://github.com/rakudo/rakudo/pull/667 .
> >
> > 
> >
> > I am glad perl6 supports complex numbers natively. What I am not glad
> > is that its definition of i does not agree with mathematics:
> >
> > % perl6
> >
> >> sqrt(-1+0i)
> > 6.12323399573677e-17+1i
> >
> > Though (-1+0i)**0.5 != 1i for most other platforms, they still get
> > sqrt(-1+0i) right:
> >
> > % python
> >
> > Python 2.7.10 (default, Oct 23 2015, 18:05:06)
> > [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
> > Type "help", "copyright", "credits" or "license" for more
> > information.
> >>>> from cmath import *
> >>>> sqrt(-1+0j)
> > 1j
> >>>> (-1+0j)**0.5
> > (6.123233995736766e-17+1j)
> >>>> ^D
> >
> > % irb
> >
> > irb(main):001:0> require 'cmath'
> > => true
> > irb(main):002:0> CMath.sqrt(-1)
> > => (0+1.0i)
> > irb(main):003:0> ^D
> >
> > % perl -MMath::Complex -dE 1
> >
> > Loading DB routines from perl5db.pl version 1.49
> > Editor support available.
> >
> > Enter h or 'h h' for help, or 'man perldebug' for more help.
> >
> > main::(-e:1):   1
> >   DB<1> p sqrt(-1+0*i)
> > i
> >   DB<2> p (-1+0*i)**0.5
> > 6.12323399573677e-17+i
> >
> > So here is the patch that defines sqrt in sqrt.
> >
> > Dan the Complex Perl6 Newbie
> >
> > ---
> > src/core/Complex.pm | 6 --
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/core/Complex.pm b/src/core/Complex.pm
> > index 8314025..74b1d5b 100644
> > --- a/src/core/Complex.pm
> > +++ b/src/core/Complex.pm
> > @@ -80,8 +80,10 @@ my class Complex is Cool does Numeric {
> > }
> >
> > method sqrt(Complex:D:) {
> > -my Num ($mag, $angle) = self.polar;
> > -$mag.sqrt.unpolar($angle/2);
> > +my Num $abs = self.abs;
> > +my Num $re = (($abs + self.re)/2).sqrt;
> > +my Num $im = (($abs - self.re)/2).sqrt;
> > +Complex.new($re, self.im < 0 ?? -$im !! $im);
> > }
> >
> > multi method exp(Complex:D:) {
> > --
> > 2.5.4 (Apple Git-61)
> 
> Pull request 667 has been merged, this ticket can be closed.
> 
> 
> Liz

Thanks! I'm closing this ticket as 'resolved'.


Re: [perl #127172] [PATCH] Support for auto-generating private accessors.

2016-01-06 Thread Elizabeth Mattijsen
> On 05 Jan 2016, at 19:34, David (via RT) <perl6-bugs-follo...@perl.org> wrote:
> 
> # New Ticket Created by  David 
> # Please include the string:  [perl #127172]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=127172 >
> 
> 
> I propose this patch so as to make private attributes user friendly
> just like public attributes. With this patch:
> 
> - rakudo will automatically generate private accessors when you
> declare a private attribute, in the same manner it does when you
> declare a public attribute.
> - it will not generate the private accessor should a private method
> with the same name exist.
> - 'is rw' and 'is readonly' now makes sense for private attributes.
> 
> The use case is as follows:
> 
> class MyClass {
>has $!secret = 5;
> 
>method sauce(MyClass $other) {
>return self!secret() + $other!secret();
>}
> }
> 
> say MyClass.new().sauce( MyClass.new() );
> 
> Instead of having to manually write a private accessor for $!secret,
> rakudo now does it for you - user friendly :-)

Yes, but at what overhead?

I’d rather see a module space solution in the form of a trait:

class MyClass {
has $!secret is accessible-by-method = 5; # auto-created method secret { 
$!secret }
}

In most cases when I’v created classes, I want private attributes to be 
private.  If you really need to be able to access them for objects other than 
self, or from the outside, either make it an attribute with an accessor, or 
create your own accessor method.

To make it DRY, a trait would be best!


my 2c worth


Liz

[perl #127172] [PATCH] Support for auto-generating private accessors.

2016-01-05 Thread via RT
# New Ticket Created by  David 
# Please include the string:  [perl #127172]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=127172 >


I propose this patch so as to make private attributes user friendly
just like public attributes. With this patch:

- rakudo will automatically generate private accessors when you
declare a private attribute, in the same manner it does when you
declare a public attribute.
- it will not generate the private accessor should a private method
with the same name exist.
- 'is rw' and 'is readonly' now makes sense for private attributes.

The use case is as follows:

class MyClass {
has $!secret = 5;

method sauce(MyClass $other) {
return self!secret() + $other!secret();
}
}

say MyClass.new().sauce( MyClass.new() );

Instead of having to manually write a private accessor for $!secret,
rakudo now does it for you - user friendly :-)

Patches attached, or can be pulled from
https://github.com/rakudo/rakudo/pull/674
https://github.com/perl6/roast/pull/94

David Ranvig,
>From e07ac0b57b6a9e2b58217354e302469d70ae8325 Mon Sep 17 00:00:00 2001
From: David Ranvig <aut...@gmail.com>
Date: Tue, 5 Jan 2016 19:03:00 +0100
Subject: [PATCH] Add tests for auto-generated private accessors.

---
 S12-attributes/instance.t  | 90 +-
 S12-introspection/attributes.t |  5 ++-
 integration/weird-errors.t | 16 +---
 3 files changed, 93 insertions(+), 18 deletions(-)

diff --git a/S12-attributes/instance.t b/S12-attributes/instance.t
index 9b6b8c0..2a604e8 100644
--- a/S12-attributes/instance.t
+++ b/S12-attributes/instance.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 150;
+plan 169;
 
 =begin pod
 
@@ -716,4 +716,92 @@ throws-like q[class RT74274 { has $!a }; my $a = 
RT74274.new(a => 42);
 ;
 }
 
+# has $!foo declares private readonly accessor
+{
+my class PrivateAccessor {
+   has $!secret = 42;
+   method peek()   { self!secret(); }
+   method poke($overt) { self!secret = $overt; }
+}
+
+my $pa = PrivateAccessor.new();
+ok(!$pa.can("secret"), 'PrivateAccessor does not have a public accessor');
+is($pa.peek(), 42, '...but it has a private accessor');
+dies-ok { $pa.poke(43) }, '...which is a readonly accessor';
+}
+
+# has $!foo is readonly declares private readonly accessor
+{
+my class PrivateAccessor {
+   has $!secret is readonly = 42;
+   method peek()   { self!secret(); }
+   method poke($overt) { self!secret = $overt; }
+}
+
+my $pa = PrivateAccessor.new();
+ok(!$pa.can("secret"), 'PrivateAccessor does not have a public accessor');
+is($pa.peek(), 42, '...but it has a private accessor');
+dies-ok { $pa.poke(43) }, '...which is a readonly accessor';
+}
+
+# has $!foo is rw declares private rw accessor
+{
+my class PrivateAccessor {
+   has $!secret is rw = 42;
+   method peek()   { self!secret(); }
+   method poke($overt) { self!secret = $overt; }
+}
+
+my $pa = PrivateAccessor.new();
+ok(!$pa.can("secret"), 'PrivateAccessor does not have a public accessor');
+is($pa.peek(), 42, '...but it has a private accessor');
+lives-ok { $pa.poke(43) }, '...which is a rw accessor';
+is($pa.peek(), 43, '...that works');
+}
+
+# has $!foo does not declare a private accessor if there is already one defined
+{
+my class PrivateAccessor {
+   has $!secret = 42;
+   method !secret() { $!secret + 1; }
+   method peek() { self!secret(); }
+}
+
+my $pa = PrivateAccessor.new();
+ok(!$pa.can("secret"), 'PrivateAccessor does not have a public accessor');
+is($pa.peek(), 43, '...the private accessor is not auto-generated');
+}
+
+# has $!foo does declare a private accessor if there is a public one defined
+{
+my class PrivateAccessor {
+   has $!secret = 42;
+   method secret() { $!secret + 1; }
+   method peek() { self!secret(); }
+}
+
+my $pa = PrivateAccessor.new();
+ok($pa.can("secret"), 'PrivateAccessor does have a public accessor');
+is($pa.secret(), 43, '...but it is not auto-generated');
+is($pa.peek(), 42, '...the private accessor is auto-generated');
+}
+
+# Can peruse private accessor within class for objects other than invocant
+{
+my class PrivateAccessor {
+   has $!secret is rw;
+   submethod BUILD(:$!secret) {}
+   method sauce(PrivateAccessor $other) { self!secret() + $other!secret() }
+   method swap-secrets(PrivateAccessor $other) { (self!secret, 
$other!secret) = ($other!secret, self!secret) }
+   method peek() { $!secret }
+}
+
+my $secret1 = PrivateAccessor.new(:secret(5));
+my $secret2 = PrivateAccessor.new(:secret(9));
+is($secret1.sauce($secret2), 14, 'PrivateAccessor can access private data 
for other than invocant');
+lives-ok { $secret1.swa

[perl #127126] [PATCH] Decent sqrt() - makes sqrt(-1+0i) == i

2016-01-02 Thread via RT
# New Ticket Created by  Dan Kogai 
# Please include the string:  [perl #127126]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=127126 >


Oops, the previous message does not contain the patch so I am submitting again. 
 Use the patch below or just pull https://github.com/rakudo/rakudo/pull/667 .



I am glad perl6 supports complex numbers natively. What I am not glad is that 
its definition of i does not agree with mathematics:

% perl6

> sqrt(-1+0i)
6.12323399573677e-17+1i

Though (-1+0i)**0.5 != 1i for most other platforms, they still get sqrt(-1+0i) 
right:

% python

   Python 2.7.10 (default, Oct 23 2015, 18:05:06) 
   [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
>>> from cmath import *
>>> sqrt(-1+0j)
   1j
>>> (-1+0j)**0.5
   (6.123233995736766e-17+1j)
>>> ^D

% irb

   irb(main):001:0> require 'cmath'
   => true
   irb(main):002:0> CMath.sqrt(-1)
   => (0+1.0i)
   irb(main):003:0> ^D

% perl -MMath::Complex -dE 1

   Loading DB routines from perl5db.pl version 1.49
   Editor support available.

   Enter h or 'h h' for help, or 'man perldebug' for more help.

   main::(-e:1):   1
     DB<1> p sqrt(-1+0*i)
   i
 DB<2> p (-1+0*i)**0.5
   6.12323399573677e-17+i

So here is the patch that defines sqrt in sqrt.

Dan the Complex Perl6 Newbie

---
 src/core/Complex.pm | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/core/Complex.pm b/src/core/Complex.pm
index 8314025..74b1d5b 100644
--- a/src/core/Complex.pm
+++ b/src/core/Complex.pm
@@ -80,8 +80,10 @@ my class Complex is Cool does Numeric {
 }
 
 method sqrt(Complex:D:) {
-my Num ($mag, $angle) = self.polar;
-$mag.sqrt.unpolar($angle/2);
+my Num $abs = self.abs;
+my Num $re = (($abs + self.re)/2).sqrt;
+my Num $im = (($abs - self.re)/2).sqrt;
+Complex.new($re, self.im < 0 ?? -$im !! $im);
 }
 
 multi method exp(Complex:D:) {
-- 
2.5.4 (Apple Git-61)





Re: [perl #127126] [PATCH] Decent sqrt() - makes sqrt(-1+0i) == i

2016-01-02 Thread Elizabeth Mattijsen
> On 02 Jan 2016, at 20:54, Dan Kogai (via RT) <perl6-bugs-follo...@perl.org> 
> wrote:
> 
> # New Ticket Created by  Dan Kogai 
> # Please include the string:  [perl #127126]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=127126 >
> 
> 
> Oops, the previous message does not contain the patch so I am submitting 
> again.  Use the patch below or just pull 
> https://github.com/rakudo/rakudo/pull/667 .
> 
> 
> 
> I am glad perl6 supports complex numbers natively. What I am not glad is that 
> its definition of i does not agree with mathematics:
> 
> % perl6
> 
>> sqrt(-1+0i)
> 6.12323399573677e-17+1i
> 
> Though (-1+0i)**0.5 != 1i for most other platforms, they still get 
> sqrt(-1+0i) right:
> 
> % python
> 
>   Python 2.7.10 (default, Oct 23 2015, 18:05:06) 
>   [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
>   Type "help", "copyright", "credits" or "license" for more information.
>>>> from cmath import *
>>>> sqrt(-1+0j)
>   1j
>>>> (-1+0j)**0.5
>   (6.123233995736766e-17+1j)
>>>> ^D
> 
> % irb
> 
>   irb(main):001:0> require 'cmath'
>   => true
>   irb(main):002:0> CMath.sqrt(-1)
>   => (0+1.0i)
>   irb(main):003:0> ^D
> 
> % perl -MMath::Complex -dE 1
> 
>   Loading DB routines from perl5db.pl version 1.49
>   Editor support available.
> 
>   Enter h or 'h h' for help, or 'man perldebug' for more help.
> 
>   main::(-e:1):   1
> DB<1> p sqrt(-1+0*i)
>   i
> DB<2> p (-1+0*i)**0.5
>   6.12323399573677e-17+i
> 
> So here is the patch that defines sqrt in sqrt.
> 
> Dan the Complex Perl6 Newbie
> 
> ---
> src/core/Complex.pm | 6 --
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/core/Complex.pm b/src/core/Complex.pm
> index 8314025..74b1d5b 100644
> --- a/src/core/Complex.pm
> +++ b/src/core/Complex.pm
> @@ -80,8 +80,10 @@ my class Complex is Cool does Numeric {
> }
> 
> method sqrt(Complex:D:) {
> -my Num ($mag, $angle) = self.polar;
> -$mag.sqrt.unpolar($angle/2);
> +my Num $abs = self.abs;
> +my Num $re = (($abs + self.re)/2).sqrt;
> +my Num $im = (($abs - self.re)/2).sqrt;
> +Complex.new($re, self.im < 0 ?? -$im !! $im);
> }
> 
> multi method exp(Complex:D:) {
> -- 
> 2.5.4 (Apple Git-61)

Pull request 667 has been merged, this ticket can be closed.


Liz

[perl #126211] [PATCH] Use Terminal::ANSIColor instead of Term::ANSIColor

2015-10-09 Thread Christian Bartolomaeus via RT
Patch was applied with commit cd8ce4e639.

I'm closing this ticket as 'resolved'.


[perl #126211] [PATCH] Use Terminal::ANSIColor instead of Term::ANSIColor

2015-09-28 Thread via RT
# New Ticket Created by  Shoichi Kaji 
# Please include the string:  [perl #126211]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=126211 >


As in https://github.com/tadzik/perl6-Term-ANSIColor/commit/be708da23d,
Term::ANSIColor is deprecated. So use Terminal::ANSIColor instead.
>From 0c682922b13d12f3179555efda6cd1345cb3c372 Mon Sep 17 00:00:00 2001
From: Shoichi Kaji <sk...@cpan.org>
Date: Mon, 28 Sep 2015 22:13:27 +0900
Subject: [PATCH] Use Terminal::ANSIColor instead of Term::ANSIColor

Because Term::ANSIColor is deprecated
See https://github.com/tadzik/perl6-Term-ANSIColor/commit/be708da23d
---
 lib/Pod/To/Text.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Pod/To/Text.pm b/lib/Pod/To/Text.pm
index 8a20605..118466a 100644
--- a/lib/Pod/To/Text.pm
+++ b/lib/Pod/To/Text.pm
@@ -6,7 +6,7 @@ method render($pod) {
 
 my 
 if %*ENV {
- = try { EVAL q{ use Term::ANSIColor;  } } // sub ($text, 
$color) { $text }
+ = try { EVAL q{ use Terminal::ANSIColor;  } } // sub 
($text, $color) { $text }
 } else {
  = sub ($text, $color) { $text }
 }
-- 
2.5.3



[perl #123678] [PATCH] Use TAP::Harness for t/harness instead of Test::Harness

2015-08-29 Thread Will Coleda via RT
On Mon Jan 26 15:02:24 2015, flusse...@gmail.com wrote:
 Hi,
 
 I saw some LHF in the test harness code and had a go at improving it.
 Doesn't add noticeable spectest speedups, sorry (just prettier code :)

Apologies for the delay in replying. Pull requests to github get -slightly- 
better turnaround time.

TAP::Harness was introduced in 5.10.1 - I'm pretty sure our current perl5 build 
requirement is 5.10.0 - I'm not sure if we are ready to bump that up.

Additionally, this patch no cleanly applies.

-- 
Will Coke Coleda


[perl #123678] [PATCH] Use TAP::Harness for t/harness instead of Test::Harness

2015-08-29 Thread Will Coleda via RT
On Mon Jan 26 15:02:24 2015, flusse...@gmail.com wrote:
 Hi,
 
 I saw some LHF in the test harness code and had a go at improving it.
 Doesn't add noticeable spectest speedups, sorry (just prettier code :)

Apologies for the delay in replying. Pull requests to github get -slightly- 
better turnaround time.

TAP::Harness was introduced in 5.10.1 - I'm pretty sure our current perl5 build 
requirement is 5.10.0 - I'm not sure if we are ready to bump that up.

Additionally, this patch no longer cleanly applies.

-- 
Will Coke Coleda


[perl #125542] [PATCH] Warn on P5ish use of \ on single sigiled variable

2015-07-04 Thread via RT
# New Ticket Created by  Brandon Allbery 
# Please include the string:  [perl #125542]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=125542 


Inspired by a p6-users message where someone was confused after attempting
to naïvely translate a use of P5ish refs to P6. Possibly the inverse case
(mistaking %(...) for P5's %{...} and similar) should also warn, and
possibly this should be made to only occur once per compilation unit.

(attached)
-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
From 0cdc736294742653b2652923f7fcbe3874daab06 Mon Sep 17 00:00:00 2001
From: brandon s allbery kf8nh allber...@gmail.com
Date: Fri, 3 Jul 2015 14:35:54 -0400
Subject: [PATCH] Warn on P5ish use of \ on single sigiled variable

---
 src/Perl6/Grammar.nqp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp
index 42e8eeb..ac2d7aa 100644
--- a/src/Perl6/Grammar.nqp
+++ b/src/Perl6/Grammar.nqp
@@ -2575,6 +2575,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
 '\\'
 [
 | '(' semiarglist ')'
+   # catch a common perl5-to-perl6 trap involving references
+| ?before '$' | '@' | '%' .worry(To pass an array or hash to a 
function in Perl 6, just pass it as is, and for other uses of Perl 5's ref 
operator consider binding with ::= instead. Parenthesize as \\(...) if you 
intended a capture of a single variable.) termish
 | ?before \S termish
 | {} .panic: You can't backslash that
 ]
-- 
1.9.1



[perl #125474] [PATCH] languages - share

2015-06-25 Thread via RT
# New Ticket Created by  g...@zimt.uni-siegen.de 
# Please include the string:  [perl #125474]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=125474 


Hello

for the repository http://github.com/rakudo/star I created a little
patch.
It changes the target from 'languages' to 'share' for the modules.
Also a little fix for the perl6 script tools/build/panda-state.p6 is
added.

Gerd

From f30500334b9f808fec405b62cfc7343308499106 Mon Sep 17 00:00:00 2001
From: gerd g...@zimt.uni-siegen.de
Date: Wed, 24 Jun 2015 15:45:54 +0200
Subject: [PATCH] languages - share

---
 tools/build/Makefile.in| 12 ++--
 tools/build/panda-state.p6 | 16 
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/tools/build/Makefile.in b/tools/build/Makefile.in
index 0dd1735..5f74c39 100644
--- a/tools/build/Makefile.in
+++ b/tools/build/Makefile.in
@@ -23,11 +23,11 @@ MKPATH= $(PERL) -MExtUtils::Command -e mkpath
 CHMOD = $(PERL) -MExtUtils::Command -e chmod
 
 PERL6_J_EXE  = perl6-j$(BAT)
-PERL6_J_LANG_DIR = $(PREFIX_DIR)/languages/perl6
+PERL6_J_LANG_DIR = $(PREFIX_DIR)/share/perl6
 PERL6_J_INSTALL  = $(JVM_BIN_DIR)/$(PERL6_J_EXE)
 
 PERL6_M_EXE  = perl6-m$(BAT)
-PERL6_M_LANG_DIR = $(PREFIX_DIR)/languages/perl6
+PERL6_M_LANG_DIR = $(PREFIX_DIR)/share/perl6
 PERL6_M_INSTALL  = $(MOAR_BIN_DIR)/$(PERL6_M_EXE)
 
 PERL6_EXE= perl6$(EXE)
@@ -62,8 +62,8 @@ modules-install-j:
$(PERL) tools/build/bin-install.pl $(PERL6_J_INSTALL) 
$(DESTDIR)$(JVM_BIN_DIR) j modules/ufo/bin/ufo modules/panda/bin/panda 
modules/doc/bin/p6doc
$(PERL) tools/build/bin-install.pl $(PERL6_J_INSTALL) 
$(DESTDIR)$(JVM_BIN_DIR) j modules/ufo/bin/ufo modules/panda/bin/panda 
modules/doc/bin/p6doc-index
$(MKPATH) $(DESTDIR)$(PERL6_J_LANG_DIR)/site/panda/
-   $(CP) install/languages/perl6/site/panda/projects.json 
$(DESTDIR)$(PERL6_J_LANG_DIR)/site/panda/
-   $(CP) install/languages/perl6/site/panda/state 
$(DESTDIR)$(PERL6_J_LANG_DIR)/site/panda/
+   $(CP) install/share/perl6/site/panda/projects.json 
$(DESTDIR)$(PERL6_J_LANG_DIR)/site/panda/
+   $(CP) install/share/perl6/site/panda/state 
$(DESTDIR)$(PERL6_J_LANG_DIR)/site/panda/
 
 modules-install-m:
@echo == Installing modules for MoarVM
@@ -72,8 +72,8 @@ modules-install-m:
$(PERL) tools/build/bin-install.pl $(PERL6_M_INSTALL) 
$(DESTDIR)$(MOAR_BIN_DIR) m modules/ufo/bin/ufo modules/panda/bin/panda 
modules/doc/bin/p6doc
$(PERL) tools/build/bin-install.pl $(PERL6_M_INSTALL) 
$(DESTDIR)$(MOAR_BIN_DIR) m modules/ufo/bin/ufo modules/panda/bin/panda 
modules/doc/bin/p6doc-index
$(MKPATH) $(DESTDIR)$(PERL6_M_LANG_DIR)/site/panda/
-   $(CP) install/languages/perl6/site/panda/projects.json 
$(DESTDIR)$(PERL6_M_LANG_DIR)/site/panda/
-   $(CP) install/languages/perl6/site/panda/state 
$(DESTDIR)$(PERL6_M_LANG_DIR)/site/panda/
+   $(CP) install/share/perl6/site/panda/projects.json 
$(DESTDIR)$(PERL6_M_LANG_DIR)/site/panda/
+   $(CP) install/share/perl6/site/panda/state 
$(DESTDIR)$(PERL6_M_LANG_DIR)/site/panda/
 
 modules-test: @backend_modules_test@
 verbose-modules-test: @backend_modules_test@
diff --git a/tools/build/panda-state.p6 b/tools/build/panda-state.p6
index 63f0316..e5f809b 100644
--- a/tools/build/panda-state.p6
+++ b/tools/build/panda-state.p6
@@ -1,12 +1,12 @@
 
 try mkdir 'install';
-try mkdir 'install/languages';
-try mkdir 'install/languages/perl6';
-try mkdir 'install/languages/perl6/site';
-try mkdir 'install/languages/perl6/site/panda';
+try mkdir 'install/share';
+try mkdir 'install/share/perl6';
+try mkdir 'install/share/perl6/site';
+try mkdir 'install/share/perl6/site/panda';
 
-my $state-file= 'install/languages/perl6/site/panda/state';
-my $projects-file = 'install/languages/perl6/site/panda/projects.json';
+my $state-file= 'install/share/perl6/site/panda/state';
+my $projects-file = 'install/share/perl6/site/panda/projects.json';
 
 fetch-projects-json($projects-file);
 
@@ -14,9 +14,9 @@ my $projects = from-json $projects-file.IO.slurp;
 
 # In case we ship a project that is just a fork of a project listed in the 
ecosystem, add
 # the mapping here.
-my %ex =
+my %ex;
 #'git://github.com/FROGGS/perl6-digest-md5' = 
'git://github.com/cosimo/perl6-digest-md5',
-Nil;
+#Nil;
 
 # Walk the submodules and put its project information in panda's state file.
 my $fh = $state-file.IO.open(:w);
-- 
2.4.3



[perl #125279] [PATCH] Fix typo in IO::Path.rename which caused bogus Cannot find method 'postcircumfix:( )'

2015-05-29 Thread via RT
# New Ticket Created by  Sam S. 
# Please include the string:  [perl #125279]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=125279 



From 0982b07b9f44df098aefa7c51948dfbb8037cae4 Mon Sep 17 00:00:00 2001
From: smls sml...@gmail.com
Date: Fri, 29 May 2015 19:59:41 +0200
Subject: [PATCH] Fix typo in IO::Path.rename

This cause a bogus Cannot find method 'postcircumfix:( )' exception to be 
thrown when trying to rename a nonexistent file, instead of returning the 
correct Failure.
---
 src/core/IO/Path.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/IO/Path.pm b/src/core/IO/Path.pm
index ace11a6..24bcc10 100644
--- a/src/core/IO/Path.pm
+++ b/src/core/IO/Path.pm
@@ -306,7 +306,7 @@ my class IO::Path is Cool {
 nqp::rename($.abspath, nqp::unbox_s($to.abspath));
 CATCH { default {
 fail X::IO::Rename.new(
-  :from($!abspath), :$to($to.abspath), :os-error(.Str) );
+  :from($!abspath), :to($to.abspath), :os-error(.Str) );
 } }
 True;
 }
-- 
2.4.1



Re: [perl #125269] [PATCH] Let .make pass on its parameter without containerizing it

2015-05-28 Thread Elizabeth Mattijsen
Fixed with 0a0051c6979d21bfdc2e

 On 28 May 2015, at 20:28, Sam S. (via RT) perl6-bugs-follo...@perl.org 
 wrote:
 
 # New Ticket Created by  Sam S. 
 # Please include the string:  [perl #125269]
 # in the subject line of all future correspondence about this issue. 
 # URL: https://rt.perl.org/Ticket/Display.html?id=125269 
 
 
 ...thus making it consistent with the make *subroutine*.
 
 ( See http://irclog.perlgeek.de/perl6/2015-05-28#i_10669973 )
 0001-Make-sure-that-.make-never-forces-itemization.patch



[perl #125269] [PATCH] Let .make pass on its parameter without containerizing it

2015-05-28 Thread via RT
# New Ticket Created by  Sam S. 
# Please include the string:  [perl #125269]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=125269 


...thus making it consistent with the make *subroutine*.

( See http://irclog.perlgeek.de/perl6/2015-05-28#i_10669973 )
From a63b2c5a0febd4ed64edf2b56e51d19a8b1ce26d Mon Sep 17 00:00:00 2001
From: smls sml...@gmail.com
Date: Thu, 28 May 2015 20:22:45 +0200
Subject: [PATCH] Make sure that .make never forces itemization

(see http://irclog.perlgeek.de/perl6/2015-05-28#i_10669973 )
---
 src/core/Match.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/Match.pm b/src/core/Match.pm
index d21a907..f827c52 100644
--- a/src/core/Match.pm
+++ b/src/core/Match.pm
@@ -82,7 +82,7 @@ my class Match is Capture is Cool {
 }
 
 method make(Match:D: Mu \made) {
-$!made = made;
+$!made := made;
 nqp::bindattr(
 nqp::decont(self.CURSOR),
 Cursor,
-- 
2.4.1



[perl #124104] [PATCH] dealing with degenerate case for polymod.

2015-03-19 Thread via RT
# New Ticket Created by  grond...@yahoo.fr 
# Please include the string:  [perl #124104]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=124104 


Hello,

While writing a version of the Van der Corput sequence in
http://rosettacode.org/wiki/Van_der_Corput_sequence#Perl_6, I've
noticed that 0.polymod($base xx *) returns nothing and I thought this is
wrong. 

I suggest the attached patch in order to have polymod return zero
whenever self is zero.From 75f1b01e951270173dc3a6d04dad18c4de9c99ac Mon Sep 17 00:00:00 2001
From: L. Grondin grond...@yahoo.fr
Date: Wed, 18 Mar 2015 08:16:59 +0100
Subject: [PATCH] dealing with degenerate case for polymod

---
 src/core/Int.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/core/Int.pm b/src/core/Int.pm
index f79330d..723c646 100644
--- a/src/core/Int.pm
+++ b/src/core/Int.pm
@@ -64,6 +64,7 @@ my class Int does Real { # declared in BOOTSTRAP
 # If self is Int, we assume mods are Ints also.  (div fails otherwise.)
 # If do-not-want, user should cast invocant to proper domain.
 method polymod(Int:D: *@mods) {
+return 0 if self == 0;
 my $more = self;
 my $inf = @mods.elems == Inf;
 fail X::OutOfRange.new(what = 'invocant to polymod', got = $more, 
range = 0..*) if $more  0;
-- 
2.1.4



[perl #123678] [PATCH] Use TAP::Harness for t/harness instead of Test::Harness

2015-01-27 Thread via RT
# New Ticket Created by  flusse...@gmail.com 
# Please include the string:  [perl #123678]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=123678 


Hi,

I saw some LHF in the test harness code and had a go at improving it.
Doesn't add noticeable spectest speedups, sorry (just prettier code :)From 74a3d77b31d2449fb62c3968768a0e92591eb077 Mon Sep 17 00:00:00 2001
From: Anthony Parsons flusse...@gmail.com
Date: Mon, 26 Jan 2015 22:16:35 +
Subject: [PATCH] Switch to using TAP::Harness directly in t/harness

The previous code would use Test::Harness unconditionally and (using a runtime
eval) require TAP::Harness conditionally, preferring the latter if present.

However, Test::Harness has been a wrapper around TAP::Harness for about 8 years
now, so the former was getting loaded and subsequently ignored completely, while
the latter was getting eval'ed and always used.

This makes TAP::Harness the default, only using eval when TAP::Harness::Archive
is requested using --archive. It also simplifies things by placing
TAP::Harness::Archive setup code in a single if-statement, in close proximity to
the other use lines.
---
 t/harness | 57 -
 1 file changed, 24 insertions(+), 33 deletions(-)

diff --git a/t/harness b/t/harness
index ed3715e384b4..4c66ea2ed727 100644
--- a/t/harness
+++ b/t/harness
@@ -10,14 +10,12 @@ use FindBin;
 use File::Spec;
 use Getopt::Long qw(:config pass_through);
 use Pod::Usage;
-
-use Test::Harness;
-$Test::Harness::switches = '';
+use TAP::Harness;
 
 GetOptions(
 'tests-from-file=s' = \my $list_file,
 'fudge' = \my $do_fudge,
-'verbosity=i'   = \$Test::Harness::verbose,
+'verbosity=i'   = \my $verbosity,
 'jobs:1'= \my $jobs,
 'icu:1' = \my $do_icu,
 'long:1'= \my $do_long,
@@ -29,6 +27,18 @@ GetOptions(
 'help|h' = sub { pod2usage(1); },
 ) or pod2usage(2);
 
+my $tap_harness_class = 'TAP::Harness';
+my $extra_properties;
+
+if ($archive) {
+$tap_harness_class .= '::Archive';
+eval require $tap_harness_class;
+or die Can't load $tap_harness_class, which is needed for smolder 
submissions: $@;
+
+$extra_properties-{'Parrot Revision'} = $parrot_revision  if 
$parrot_revision;
+$extra_properties-{'Submitter'} = $ENV{SMOLDER_SUBMITTER} if 
$ENV{SMOLDER_SUBMITTER};
+}
+
 $do_long = 1 unless defined $do_long;
 $do_stress = 0 unless defined $do_stress;
 
@@ -74,17 +84,6 @@ if ($do_fudge) {
 @tfiles = fudge(@tfiles);
 }
 
-my $tap_harness_class = 'TAP::Harness';
-$tap_harness_class .= '::Archive' if $archive;
-
-my $extra_properties;
-if ($archive) {
-$extra_properties-{'Parrot Revision'} = $parrot_revision
-if $parrot_revision;
-$extra_properties-{'Submitter'} = $ENV{SMOLDER_SUBMITTER}
-if $ENV{SMOLDER_SUBMITTER};
-}
-
 if ($jvm) {
 unlink(TESTTOKEN);
 $ENV{HARNESS_PERL} = $^X .${slash}eval-client.pl TESTTOKEN run;
@@ -95,24 +94,16 @@ if ($jvm) {
 sleep 1;
 }
 
-if (eval require $tap_harness_class;) {
-my %harness_options = (
-exec= $jvm ? [$^X, ./eval-client.pl, TESTTOKEN, run] : 
[$ENV{HARNESS_PERL}],
-verbosity   = 0+$Test::Harness::verbose,
-jobs= $jobs || $ENV{TEST_JOBS} || 1,
-ignore_exit = 1,
-merge   = 1,
-$archive ? ( archive = $archive ) : (),
-$extra_properties ? ( extra_properties = $extra_properties ) : (),
-);
-$tap_harness_class-new( \%harness_options )-runtests(@tfiles);
-}
-elsif ($archive) {
-die Can't load $tap_harness_class, which is needed for smolder 
submissions: $@;
-}
-else {
-runtests(@tfiles);
-}
+my %harness_options = (
+exec= $jvm ? [$^X, ./eval-client.pl, TESTTOKEN, run] : 
[$ENV{HARNESS_PERL}],
+verbosity   = $verbosity,
+jobs= $jobs || $ENV{TEST_JOBS} || 1,
+ignore_exit = 1,
+merge   = 1,
+$archive ? ( archive = $archive ) : (),
+$extra_properties ? ( extra_properties = $extra_properties ) : (),
+);
+$tap_harness_class-new( \%harness_options )-runtests(@tfiles);
 
 # adapted to return only files ending in '.t'
 sub all_in {
-- 
2.2.1



[perl #123496] [PATCH] Make use vstring for v 5 or v 6 an error.

2014-12-27 Thread via RT
# New Ticket Created by  Konrad Borowski 
# Please include the string:  [perl #123496]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=123496 


---
 src/Perl6/Grammar.nqp | 32 +++-
 src/core/Exception.pm |  7 +++
 2 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp
index 2000376..69bef42 100644
--- a/src/Perl6/Grammar.nqp
+++ b/src/Perl6/Grammar.nqp
@@ -1576,15 +1576,29 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
 $doc=[ 'DOC' \h+ ]**0..1
 sym .ws
 [
-| version [ ?{ ~$versionvnum[0] eq '5' } {
-my $module := $*W.load_module($/, 'Perl5', {}, 
$*GLOBALish);
-do_import($/, $module, 'Perl5');
-$/.CURSOR.import_EXPORTHOW($/, $module);
-} ]?
-[ ?{ ~$versionvnum[0] eq '6' } {
-$*MAIN   := 'MAIN';
-$*STRICT := 1 if $*begin_compunit;
-} ]?
+| version [
+||  ?{ $versionvnum[0] == 5 } {
+my $module := $*W.load_module($/, 'Perl5', {}, 
$*GLOBALish);
+do_import($/, $module, 'Perl5');
+$/.CURSOR.import_EXPORTHOW($/, $module);
+}
+||  ?{ $versionvnum[0] == 6 } {
+my $version_parts := $versionvnum;
+my $tokens := +$version_parts;
+my $position := 1;
+while $position  $tokens {
+if $version_parts[$position] != 0 {
+$/.CURSOR.typed_panic: 
'X::Language::Unsupported', version = ~$version;
+}
+$position++;
+}
+$*MAIN   := 'MAIN';
+$*STRICT := 1 if $*begin_compunit;
+}
+||  {
+$/.CURSOR.typed_panic: 'X::Language::Unsupported', 
version = ~$version;
+}
+]
 | module_name
 {
 $longname := $module_namelongname;
diff --git a/src/core/Exception.pm b/src/core/Exception.pm
index 1bc3739..4b26419 100644
--- a/src/core/Exception.pm
+++ b/src/core/Exception.pm
@@ -1614,4 +1614,11 @@ my class X::EXPORTHOW::Conflict does X::Comp {
 }
 }
 
+my class X::Language::Unsupported is Exception {
+has $.version;
+method message() {
+No compiler available for Perl $.version
+}
+}
+
 # vim: ft=perl6 expandtab sw=4
-- 
2.2.1


[perl #121072] [PATCH] Use the git protocol instead of https, as the build is breaking in systems where curl-devel packages are not installed(Or more importantly can't be installed, due to various rea

2014-01-24 Thread Will Coleda via RT
On Thu Jan 23 22:11:10 2014, arafatkam...@gmail.com wrote:
 

There are other situations where *only* http connections are allowed, and git 
connections are not (corporate firewalls). I'd like to have some discussion 
here before it gets applied.

-- 
Will Coke Coleda


Re: [perl #121072] [PATCH] Use the git protocol instead of https, as the build is breaking in systems where curl-devel packages are not installed(Or more importantly can't be installed, due to various

2014-01-24 Thread Moritz Lenz
On 01/24/2014 05:15 PM, Will Coleda via RT wrote:
 On Thu Jan 23 22:11:10 2014, arafatkam...@gmail.com wrote:
 
 
 There are other situations where *only* http connections are allowed, and git 
 connections are not (corporate firewalls). I'd like to have some discussion 
 here before it gets applied.

I've started a discussion here:

https://github.com/perl6/nqp/pull/153

Cheers,
Moritz


[perl #121072] [PATCH] Use the git protocol instead of https, as the build is breaking in systems where curl-devel packages are not installed(Or more importantly can't be installed, due to various rea

2014-01-23 Thread via RT
# New Ticket Created by  mohammed arafat Kamaal 
# Please include the string:  [perl #121072]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=121072 



From 7aced261936a8b5e807ccfc06b9c6174370ca741 Mon Sep 17 00:00:00 2001
From: kamaal arafatkam...@gmail.com
Date: Fri, 24 Jan 2014 06:04:40 +
Subject: [PATCH] Use the git protocol instead of https, as the build is
 breaking in systems where curl-devel packages are not
 installed(Or more importantly can't be installed, due to
 various reasons)

---
 tools/lib/NQP/Configure.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lib/NQP/Configure.pm b/tools/lib/NQP/Configure.pm
index 000845e..86ee08c 100644
--- a/tools/lib/NQP/Configure.pm
+++ b/tools/lib/NQP/Configure.pm
@@ -29,9 +29,9 @@ our @required_nqp_files = qw(
 @bindir@/nqp-p@exe@
 );
 
-our $nqp_git = 'https://github.com/perl6/nqp.git';
-our $par_git = 'https://github.com/parrot/parrot.git';
-our $moar_git= 'https://github.com/MoarVM/MoarVM.git';
+our $nqp_git = 'git://github.com/perl6/nqp.git';
+our $par_git = 'git://github.com/parrot/parrot.git';
+our $moar_git= 'git://github.com/MoarVM/MoarVM.git';
 
 our $nqp_push = 'g...@github.com:perl6/nqp.git';
 our $par_push = 'g...@github.com:parrot/parrot.git';
-- 
1.7.12



[perl #120520] [PATCH] Fix building multiple backends on moar-support branch

2013-11-12 Thread via RT
# New Ticket Created by  Nick Glencross 
# Please include the string:  [perl #120520]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=120520 


Hi all,

This patch fixes a problem where RUN_PERL6 is clashing across build
variants.

It needs applying to the moar-support branch.

Without it you can get the following, mixing up java/moar.

The following step can take a long time, please be patient.
/home/nickg/src/rakudo/../moarvm/bin/moar
--libpath=/home/nickg/src/rakudo/../moarvm/languages/nqp/lib perl6.moarvm
--setting=NULL --optimize=3 --target=jar --stagestats
--output=CORE.setting.jar gen/jvm/CORE.setting
Unhandled exception: While looking for 'perl6.moarvm': no such file or
directory

Cheers,

Nick
From 70b0d48c0d290442cb40f5b66b3565ca58314904 Mon Sep 17 00:00:00 2001
From: Nick Glencross nick.glencr...@gmail.com
Date: Tue, 12 Nov 2013 15:25:08 +
Subject: [PATCH] This fixes a build problem when you run Configure with
 '-backends=moar,jvm'.

We make RUN_PERL6 unique to each build variant.
---
 tools/build/Makefile-JVM.in  | 4 ++--
 tools/build/Makefile-Moar.in | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/build/Makefile-JVM.in b/tools/build/Makefile-JVM.in
index 378a2c0..a452347 100644
--- a/tools/build/Makefile-JVM.in
+++ b/tools/build/Makefile-JVM.in
@@ -12,7 +12,7 @@ PERL6_LANG_DIR = $(PREFIX)/languages/perl6
 
 NQP_JARS = @nqp_jars@
 
-RUN_PERL6 = $(JAVA) -Xss1m -Xms500m -Xmx1600m 
-Xbootclasspath/a:.@cpsep@$(NQP_JARS)@cp...@rakudo-runtime.jar@cp...@perl6.jar 
-cp @nqp_classpath@ perl6
+J_RUN_PERL6 = $(JAVA) -Xss1m -Xms500m -Xmx1600m 
-Xbootclasspath/a:.@cpsep@$(NQP_JARS)@cp...@rakudo-runtime.jar@cp...@perl6.jar 
-cp @nqp_classpath@ perl6
 
 RUNTIME_JAVAS = src/vm/jvm/runtime/org/perl6/rakudo/*.java
 
@@ -248,7 +248,7 @@ $(PERL6_B_JAR): $(BOOTSTRAP_SOURCES) $(PERL6_M_JAR)
 $(SETTING_JAR): $(PERL6_JAR) $(PERL6_B_JAR) $(J_CORE_SOURCES)
$(PERL) $(J_GEN_CAT) $(J_CORE_SOURCES)  $(J_BUILD_DIR)/CORE.setting
@echo The following step can take a long time, please be patient.
-   $(RUN_PERL6) --setting=NULL --optimize=3 --target=jar --stagestats 
--output=$(SETTING_JAR) $(J_BUILD_DIR)/CORE.setting
+   $(J_RUN_PERL6) --setting=NULL --optimize=3 --target=jar --stagestats 
--output=$(SETTING_JAR) $(J_BUILD_DIR)/CORE.setting
 
 $(RUNNER):
$(PERL) tools/build/create-jvm-runner.pl dev . . $(NQP_PREFIX) 
$(NQP_JARS)
diff --git a/tools/build/Makefile-Moar.in b/tools/build/Makefile-Moar.in
index 7da39a1..2983401 100644
--- a/tools/build/Makefile-Moar.in
+++ b/tools/build/Makefile-Moar.in
@@ -11,7 +11,7 @@ PREFIX = @prefix@
 MOAR   = $(PREFIX)@slash@bin@slash@moar@exe@
 M_NQP  = $(PREFIX)@slash@bin@slash@nqp-m@runner_suffix@
 
-RUN_PERL6 = $(MOAR) --libpath=$(PREFIX)@slash@languages@slash@nqp@slash@lib 
perl6.moarvm
+M_RUN_PERL6 = $(MOAR) 
--libpath=$(PREFIX)@slash@languages@slash@nqp@slash@lib perl6.moarvm
 
 M_RUNNER = perl6-m@runner_suffix@
 
@@ -244,7 +244,7 @@ $(PERL6_B_MOAR): $(BOOTSTRAP_SOURCES) $(PERL6_M_MOAR)
 $(SETTING_MOAR): $(PERL6_MOAR) $(PERL6_B_MOAR) $(M_CORE_SOURCES)
$(PERL) $(M_GEN_CAT) $(M_CORE_SOURCES)  src/gen/m-CORE.setting
@echo The following step can take a long time, please be patient.
-   $(RUN_PERL6) --setting=NULL --optimize=3 --target=mbc --stagestats 
--output=$(SETTING_MOAR) src/gen/m-CORE.setting
+   $(M_RUN_PERL6) --setting=NULL --optimize=3 --target=mbc --stagestats 
--output=$(SETTING_MOAR) src/gen/m-CORE.setting
 
 $(M_RUNNER): tools/build/gen-moar-runner.pl $(PERL6_MOAR)
$(PERL) tools/build/gen-moar-runner.pl $(MOAR) .
-- 
1.8.3.2



Re: [perl #120520] [PATCH] Fix building multiple backends on moar-support branch

2013-11-12 Thread Tobias Leich
Patch applied, thank you! :o)

https://github.com/rakudo/rakudo/commit/f5a38f2e97

Am 12.11.2013 16:35, schrieb Nick Glencross (via RT):
 # New Ticket Created by  Nick Glencross 
 # Please include the string:  [perl #120520]
 # in the subject line of all future correspondence about this issue. 
 # URL: https://rt.perl.org/Ticket/Display.html?id=120520 


 Hi all,

 This patch fixes a problem where RUN_PERL6 is clashing across build
 variants.

 It needs applying to the moar-support branch.

 Without it you can get the following, mixing up java/moar.

 The following step can take a long time, please be patient.
 /home/nickg/src/rakudo/../moarvm/bin/moar
 --libpath=/home/nickg/src/rakudo/../moarvm/languages/nqp/lib perl6.moarvm
 --setting=NULL --optimize=3 --target=jar --stagestats
 --output=CORE.setting.jar gen/jvm/CORE.setting
 Unhandled exception: While looking for 'perl6.moarvm': no such file or
 directory

 Cheers,

 Nick



[perl #120372] [PATCH] fix rakudo jvm Configure line in doc

2013-10-27 Thread via RT
# New Ticket Created by  Steve Mynott 
# Please include the string:  [perl #120372]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=120372 



From a83f824ec414393bb9ed4ca756b2301b88a51a5a Mon Sep 17 00:00:00 2001
From: Steve Mynott steve.myn...@gmail.com
Date: Sat, 26 Oct 2013 11:15:14 +0100
Subject: [PATCH] fix rakudo jvm Configure line in doc

---
 README |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README b/README
index 6a81b92..480e673 100644
--- a/README
+++ b/README
@@ -34,7 +34,7 @@ Rakudo Perl 6
 will fetch an appropriate revision of nqp, build it, and then build
 rakudo on the jvm.
 
-$ perl ConfigureJVM.pl --gen-nqp
+$ perl Configure.pl --gen-nqp --backends=jvm
 $ make
 
 Note that Rakudo on JVM implements a slightly different set of features
-- 
1.7.10.4



[perl #119353] [PATCH] label added in the grammar

2013-08-19 Thread via RT
# New Ticket Created by  equinox 
# Please include the string:  [perl #119353]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119353 


Hi,


A patch..

I ran the spec test. No regression.

jaffa4

From bdad335a315685f5670dd621235e5a91fff0a075 Mon Sep 17 00:00:00 2001
From: Marton Papp ante...@freemail.hu
Date: Sun, 18 Aug 2013 13:54:25 +0200
Subject: [PATCH] added recognizing labels

---
 src/Perl6/Grammar.nqp | 16 
 1 file changed, 16 insertions(+)

diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp
index 9249a44..3dc2077 100644
--- a/src/Perl6/Grammar.nqp
+++ b/src/Perl6/Grammar.nqp
@@ -995,6 +995,21 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
 ]
 }
 
+token label {
+:my $label;
+identifier ':' ?before \s .ws
+
+#[ ?{ $*W.is_name($label := $identifier.Str) }
+#  .sorry(Illegal redeclaration of '$label')
+#]?
+
+# add label as a pseudo type
+#{{ $*W.add_my_name($label); }}
+
+{self.panic(labels are not yet implemented);}
+
+}
+
 token statement {
 :my $*QSIGIL := '';
 :my $*SCOPE := '';
@@ -1003,6 +1018,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
 !stopper
 !!{ nqp::rebless($/.CURSOR, %*LANGMAIN) }
 [
+| label statement
 | statement_control
 | EXPR :dba('statement end')
 [
-- 
1.7.11.msysgit.1



[perl #119323] [PATCH] Option to use HTTPS instead of GIT protocol

2013-08-16 Thread Vladimir N. Indik
# New Ticket Created by  Vladimir N. Indik 
# Please include the string:  [perl #119323]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119323 


Hi!

In my workplace I use http-proxy and can't use git native protocol for
sync with github.
Patch in attach adds an option for use HTTPS instead of git native protocol.

-- 
Vladimir N. Indik
1;From 1f8dc42ebd85547fe2e458a5c5e6f87fd95f1556 Mon Sep 17 00:00:00 2001
From: Vladimir N. Indik vo...@vovka667.org
Date: Fri, 16 Aug 2013 11:05:22 +0400
Subject: [PATCH] Added --git-https option to Configure.pl

---
 Configure.pl   |3 ++-
 tools/lib/NQP/Configure.pm |9 ++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Configure.pl b/Configure.pl
index 6f6c42c..35dc5df 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -32,7 +32,7 @@ MAIN: {
'with-nqp=s', 'gen-nqp:s',
'with-parrot=s', 'gen-parrot:s', 'parrot-option=s@',
'parrot-make-option=s@',
-   'make-install!', 'makefile-timing!',
+   'make-install!', 'makefile-timing!', 'git-https',
 ) or do {
 print_help();
 exit(1);
@@ -170,6 +170,7 @@ General Options:
Options to pass to Parrot's make, for example:
--parrot-make-option='--jobs=4'
 --makefile-timing  Enable timing of individual makefile commands
+--git-httpsUse HTTPS instead of GIT protocol
 
 Configure.pl also reads options from 'config.default' in the current directory.
 END
diff --git a/tools/lib/NQP/Configure.pm b/tools/lib/NQP/Configure.pm
index d316bd8..7b708c8 100644
--- a/tools/lib/NQP/Configure.pm
+++ b/tools/lib/NQP/Configure.pm
@@ -27,9 +27,6 @@ our @required_nqp_files = qw(
 @bindir@/nqp@exe@
 );
 
-our $nqp_git = 'git://github.com/perl6/nqp.git';
-our $par_git = 'git://github.com/parrot/parrot.git';
-
 sub sorry {
 my @msg = @_;
 die join(\n, '', '===SORRY!===', @msg, \n);
@@ -248,6 +245,9 @@ sub gen_nqp {
 my $gen_parrot  = $options{'gen-parrot'};
 my $prefix  = $options{'prefix'} || cwd().'/install';
 my $startdir= cwd();
+my $nqp_git = $options{'git-https'} ?
+'https://github.com/perl6/nqp.git' :
+'git://github.com/perl6/nqp.git';
 
 my $PARROT_REVISION = 'nqp/tools/build/PARROT_REVISION';
 
@@ -309,6 +309,9 @@ sub gen_parrot {
 my $gen_parrot = $options{'gen-parrot'};
 my @opts   = @{ $options{'parrot-option'} || [--optimize] };
 my $startdir   = cwd();
+my $par_git= $options{'git-https'} ?
+'https://github.com/parrot/parrot.git' :
+'git://github.com/parrot/parrot.git';
 
 my $par_exe  = $options{'prefix'}/bin/parrot$exe;
 my %config   = read_parrot_config($par_exe);
-- 
1.7.9.5


[perl #78152] [PATCH] Remove rakudo build dependency on shell/backticks and allow smoother windows (g|mingw32-)make spectest_smolder

2013-05-25 Thread Will Coleda via RT
On Sat Oct 08 13:47:10 2011, coke wrote:
 On Sat Oct 02 03:23:18 2010, moritz wrote:
  Thanks for the patch, I've applied it.
  
  I'm leaving this ticket open for now, until we've decided what to do
  about the documentation.
 
 Let's either add a Windows section to the main README, or a new 
 README.win32.
 
 I will happily apply such a patch!

Added a section to the tail of INSTALL.txt
-- 
Will Coke Coleda


[perl #93576] [PATCH] Allow (g|mingw32-)make t/spec/S02-builtin_data_types/anon_block.t (or any other test file) workable under Windows

2013-03-28 Thread Will Coleda via RT
I'm sorry, I was going through the bug queue and found this patch - I tried to 
apply it and it 
unfortunately no longer applies. I'm going to reject this ticket - if this is 
still any issue for with a 
recent version of rakudo, please open a new ticket. 

Thanks.

On Sun Jun 26 10:47:06 2011, ronaldxs wrote:
 Under Linux if you are in the rakudo build directory and type make 
 t/spec/S02-builtin_data_types/anon_block.t  (or make followed by the 
 name of any test file) the test file is run with the right configuration 
 and command line parameters to make #? skip and #? todo directives 
 etc behave properly.  This currently does not seem to work on Windows.  
 It doesn't work for me and after a discussion on IRC with JimmyZ, see 
 http://irclog.perlgeek.de/perl6/2011-06-26#i_4005711, it became clear it 
 didn't work for him on Windows either.
 
 I have attached a patch that fixes the problem to the point of having 
 such a command line request usable under windows.  The solution is 
 somewhat lacking in that it doesn't allow the test file names provided 
 to make to have the '\' back slash separators that are native to Windows 
 but includes a comment in the make file to document around the issue.  
 I hope and believe that the patch makes the situation better than it is 
 now.  The patch takes out the translation of \* to \\* that, I believe, 
 was intended to work around this at one point but after testing with 
 gmake and strawberry Perl as well as mingw32-make and ActiveState Perl 
 believe that the build and install  work properly without that 
 translation and with this patch.
 
 Hope this helps,
 Ron Schmidt


-- 
Will Coke Coleda


[perl #82312] [PATCH] optimized Range for getting its size if its a numeric range

2013-03-28 Thread Will Coleda via RT
On Wed Jan 19 01:29:06 2011, payload wrote:
 On Mo, 2011-01-17 at 13:34 -0800, Moritz Lenz via RT wrote:
  On 01/16/2011 07:47 PM, Gilbert R. Roehrbein (via RT) wrote:
   fixes the problem which you encounter when you try to evaluate
   +(23..23)
  
  ... and creates others. Consider
  
  (0..^3.3).Numeric
  
  Where you patch makes it return 3, but 4 is the correct answer.
 
 shame :( but fixed it ^^
 
  Maybe checking for ~~ Int instead of ~~ Numeric helps, but we also need
  to more tests.
 
 does now work for following ranges
 
 for $(^3.3), $(0..3), $(-2..0), $(-2.9..3.1), $(1.9..3.1) {
 my $a := +$_;
 my $b := .elems;
 say {.perl}\t\t$a != $b if $a != $b;
 }


Sorry about the delay:

Added tests to S02-types/range.t, and applied a heavily modified version of the 
patch (there 
were some edge cases that were still failing with the patch as is.)

$ time ./perl6 -e 'say +(123..123121231231231212321)'
123121231231231212199

real0m0.475s
user0m0.369s
sys 0m0.101s


-- 
Will Coke Coleda


[perl #116026] [PATCH] Added functionality for strings to be reversed like lists

2012-12-09 Thread via RT
# New Ticket Created by  Zachary Bornheimer 
# Please include the string:  [perl #116026]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=116026 


Currently, Perl6 is lacking the built-in functionality of running

'this is a string'.reverse or reverse 'this is a string'

and getting the desired result.  With this patch, I have added the sub for
reversing strings and also the Str method and fixes this problem

## Z. Bornheimer


0002-Added-the-functionality-to-reverse-strings-with-a-re.patch
Description: Binary data


Re: [perl #116026] AutoReply: [PATCH] Added functionality for strings to be reversed like lists

2012-12-09 Thread Zachary Bornheimer
I'm not sure my patch was received, so here it is in the body of this email:

Patch Start

From a159724ab2125ba9f61534ae2d6de3c1b98485ce Mon Sep 17 00:00:00 2001
From: Z. Bornheimer z...@chary.me
Date: Sat, 8 Dec 2012 11:47:26 -0500
Subject: [PATCH 2/2] Added the functionality to reverse strings with a
reverse method or reverse sub

---
 src/core/List.pm |4 +++-
 src/core/Str.pm  |5 +
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/core/List.pm b/src/core/List.pm
index b89b3d2..6f35347 100644
--- a/src/core/List.pm
+++ b/src/core/List.pm
@@ -7,6 +7,7 @@ my class List does Positional {

 method new(|) {
 my Mu $args := pir::perl6_current_args_rpa__P();
+say $args.perl;
 nqp::shift($args);
 nqp::p6list($args, self.WHAT, Mu);
 }
@@ -411,7 +412,8 @@ multi sub unshift(\a, *@elems) { a.unshift: @elems }
 proto sub push(|) {*}
 multi sub push(\a, *@elems) { a.push: @elems }

-sub reverse(*@a){ @a.reverse }
+multi sub reverse(*@a){ @a.reverse }
+multi sub reverse(*$a){ return $a.split('').reverse.join('') }
 sub rotate(@a, Int $n = 1)  { @a.rotate($n) }
 sub reduce (with, *@list)  { @list.reduce(with) }
 sub categorize(mapper, *@a){ @a.categorize(mapper)}
diff --git a/src/core/Str.pm b/src/core/Str.pm
index 279e278..5042008 100644
--- a/src/core/Str.pm
+++ b/src/core/Str.pm
@@ -68,6 +68,11 @@ my class Str does Stringy {
 nqp::p6box_s(pir::chopn__Ssi(nqp::unbox_s(self), 1))
 }

+method reverse(Str:D:) {
+my $var = self.split('').reverse.join('');
+$var;
+}
+
 method substr(Str:D: $start, $length? is copy) {
 my str $sself  = nqp::unbox_s(self);
 my int $istart = nqp::unbox_i(
-- 
1.7.1


Patch End


## Z. Bornheimer


On Sat, Dec 8, 2012 at 12:32 PM, perl6 via RT
perl6-bugs-follo...@perl.orgwrote:

 Greetings,

 This message has been automatically generated in response to the
 creation of a trouble ticket regarding:
 [PATCH] Added functionality for strings to be reversed like
 lists,
 a summary of which appears below.

 There is no need to reply to this message right now.  Your ticket has been
 assigned an ID of [perl #116026].

 Please include the string:

  [perl #116026]

 in the subject line of all future correspondence about this issue. To do
 so,
 you may reply to this message.

 Thank you,
 perl6-bugs-follo...@perl.org

 -
 Currently, Perl6 is lacking the built-in functionality of running

 'this is a string'.reverse or reverse 'this is a string'

 and getting the desired result.  With this patch, I have added the sub for
 reversing strings and also the Str method and fixes this problem

 ## Z. Bornheimer




[perl #115120] [PATCH] Add minimal 'x' flag to pack()

2012-10-13 Thread Will Coleda via RT
This patch was applied by moritz++ and the OP supplied tests.

Closing ticket.

-- 
Will Coke Coleda


Re: [perl #115120] AutoReply: [PATCH] Add minimal 'x' flag to pack()

2012-10-12 Thread Timothy Totten
I have added 3 new tests to the S32-str/pack.t test file in 'roast'
that test the functionality of this patch.


[perl #115120] [PATCH] Add minimal 'x' flag to pack()

2012-10-05 Thread via RT
# New Ticket Created by  Timothy Totten 
# Please include the string:  [perl #115120]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=115120 


Find patch attached.


0001-Added-x-to-pack.patch
Description: Binary data


[perl #111426] [PATCH] Error building nqp 2012.02 on NetBSD

2012-02-29 Thread via RT
# New Ticket Created by  Mike Small 
# Please include the string:  [perl #111426]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=111426 



I got this error building rakudo star 2012.01 and again with the latest
nqp from git on NetBSD 5.1:

--
cd 3rdparty/dyncall  BUILD_DIR=. make
make: no target to make.

make: stopped in /usr/local/src/nqp/3rdparty/dyncall
*** Error code 2

Stop.
make: stopped in /usr/local/src/nqp
-

NetBSD's make (unlike OpenBSD's and FreeBSD's) doesn't look for
BSDmakefile, only makefile and Makefile, so it can't find any targets in
the dyncall directory. The dyncall manual says to use
make -f BSDmakefile for NetBSD.  The attached patch does that.

--
Mike Small
sma...@panix.com

From f1b736029d356c04958b5e24230883a5cfe503af Mon Sep 17 00:00:00 2001
From: Mike Small sma...@panix.com
Date: Tue, 28 Feb 2012 23:10:52 -0500
Subject: [PATCH] Fix build problem in NetBSD. NetBSD's make doesn't look for
 BSDmakefile. Dyncall manual says to build with -f
 BSDmakefile. OpenBSD and FreeBSD should be fine as is,
 since their makes do look for BSDmakefile.

---
 Configure.pl |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Configure.pl b/Configure.pl
index 4eaf937..0fcf2d8 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -126,7 +126,11 @@ MAIN: {
 $config{'dyncall_build'} = cd 3rdparty/dyncall  $make BUILD_DIR=. -f GNUmakefile;
 } else {
 system_or_die('cd 3rdparty/dyncall  sh configure');
-$config{'dyncall_build'} = cd 3rdparty/dyncall  BUILD_DIR=. $make;
+if ($^O eq 'netbsd') {
+$config{'dyncall_build'} = cd 3rdparty/dyncall  BUILD_DIR=. $make -f BSDmakefile;
+} else {
+$config{'dyncall_build'} = cd 3rdparty/dyncall  BUILD_DIR=. $make;
+}
 }
 }
 
-- 
1.7.7.2



RE: [perl #78626] Patch: support higher arity in reduce()

2011-12-08 Thread s mosher

Hi Moritz,

Thanks for the explanation, I  appreciate it and I can certainly appreciate the 
difficulty. 

(Sorry for not getting back sooner, I missed your email until now.) It's a bit 
of a shame since I expect most of the time .reduce will be called with a 
closure. If the general solution can be had, that is mighty impressive. I sort 
of oppose the notion that you can't provide a useful feature because the rarely 
more useful general case is too difficult to implement right now (if it was my 
task I'd be rejecting multis—forever) but I write a lot of Perl 5 too, and I 
don't feel regret when I have to use a utility module to make up for something 
that doesn't suit me and I'm happy to do the same in this case in Perl 6 for as 
long as is necessary.

Best Regards,
Stephen

P. S. Thanks for all your work on Perl 6—that goes for everyone involved. It's 
a great language whichever way you slice it.

 Subject: Re: [perl #78626] Patch: support higher arity in reduce()
 From: perl6-bugs-follo...@perl.org
 To: smosh...@hotmail.com
 Date: Thu, 13 Oct 2011 02:02:28 -0700
 
 Am 13.10.2011 06:01, schrieb smos...@loveandhotsauce.net:
  That's fine, I think it was already shot down owing to the supposedly
  dubious utility of supporting higher arities in .reduce()
 
  By the way, I submitted the patch because the error message had (and
  still has) the for now wording when you try any other arity. But after
  I submitted the patch I was asked to defend non-binary reduce. After
  scratching my head I might have replied with some mumblings about
  continued fractions or something, but I don't understand why I was asked
  while that particular wording is still in place—either it's binary only
  or it isn't, or perhaps it's just not specced.
 
  I can appreciate the added complication in checking when a non-binary
  reduce should actually terminate, and other concerns. If I knew that the
  functionality was desired, I'd be happy to submit another patch. At the
  moment a change in the wording in src/core/List.pm might be advisable,
  line 296: fail('can only reduce with arity 2 for now'), dropping the
  for now if the functionality is not in fact desired.
 
 Let me provide some context for the for now here. I'm not defending 
 that phrase (and will remove it), just want to provide some food for 
 thought.
 
 Back when you wrote the patch, we did find higher arity reduce 
 desirable, and I think some of us are still emotionally attached to the 
 idea.
 
 The problem is that the complexity of signatures makes it basically 
 impossible to figure out which candidate to call if the reducer is a 
 multi, and thus to decide how many arguments to pass.
 
 The idea back then was to somhow specific a mechanism for supplying a 
 (possibly lazy) stream of arguments to a set of multi candidates, and 
 have the call eat up an apropriate amount of arguments. Such a mechansim 
 would be useful in other places as well (such as 'for' and 'map' with 
 blocks of higher arity), and it would be a very nice anaolgy to regexes. 
 And like the famous longest token matching [1] in regexes, we'd expect 
 such a mechanism to be mostly greedy, ie the candidate that binds the 
 most arguments wins, unless other circumstances prevent that from 
 happening (you see, it's rather vague).
 
 I have no idea how feasible such a mechanism is, and if it will be 
 included in Perl 6 at all. But I'm sure that if it will be defined, it 
 will be on a much lower level than reduce -- probably in the multi 
 dispatcher directly.
 
 Up to now such a spec hasn't happened, but the idea keeps simmering in 
 the back of the minds of several Perl 6 hackers.
 
 Cheers,
 Moritz
 
 
  

Re: [perl #101858] [PATCH] [BUG] List.unshift won't unshift false values in nom

2011-10-21 Thread Geoffrey Broadwell
See attached short patch to src/core/List.pm to fix #101858.


-'f

From d18c6af3e8c8bd2e1dc43d132fcc2cb39fc41e6c Mon Sep 17 00:00:00 2001
From: Geoffrey Broadwell ge...@broadwell.org
Date: Thu, 20 Oct 2011 21:28:36 -0700
Subject: [PATCH] List.unshift(): loop while @elems is non-empty, not while first element is true; fixes #101858

---
 src/core/List.pm |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/core/List.pm b/src/core/List.pm
index 0fa72bd..e679717 100644
--- a/src/core/List.pm
+++ b/src/core/List.pm
@@ -194,9 +194,7 @@ my class List does Positional {
 }
 
 method unshift(*@elems) {
-while @elems.pop - $e {
-nqp::unshift($!items, $e)
-}
+nqp::unshift($!items, @elems.pop) while @elems;
 self
 }
 
-- 
1.7.4.1



[perl #101474] [PATCH] DWIM better in orig-string role in MAIN_HELPER()

2011-10-17 Thread Carl Mäsak via RT
On Sun Oct 16 16:23:14 2011, geo...@corp.sonic.net wrote:
 Attached please find a patch that makes the orig-string role
 in nom's MAIN_HELPER() DWIM a better.

Applied; closing ticket.


[perl #101464] [PATCH] Changes since snapshot 1 of main-usage

2011-10-17 Thread Carl Mäsak via RT
On Sun Oct 16 14:33:58 2011, g...@sonic.net wrote:
 Attached please find a patch updating nom's src/core/Main.pm to the
 latest snapshot from my local branch.

Applied; closing ticket.


[perl #101464] [PATCH] Changes since snapshot 1 of main-usage

2011-10-17 Thread via RT
# New Ticket Created by  Geoffrey Broadwell 
# Please include the string:  [perl #101464]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=101464 


Attached please find a patch updating nom's src/core/Main.pm to the
latest snapshot from my local branch.


-'f

From 958534bb906db741e57e054e1c036f0e298b5f39 Mon Sep 17 00:00:00 2001
From: Geoffrey Broadwell ge...@broadwell.org
Date: Sun, 16 Oct 2011 14:29:51 -0700
Subject: [PATCH] Merge WIP snapshot 2 of main-usage

---
 src/core/Main.pm |   99 -
 1 files changed, 60 insertions(+), 39 deletions(-)

diff --git a/src/core/Main.pm b/src/core/Main.pm
index 04c3638..09cdbad 100644
--- a/src/core/Main.pm
+++ b/src/core/Main.pm
@@ -1,16 +1,23 @@
 # TODO:
+# * Align number parsing to STD
+#   * Rakudo's .Numeric
+# * complex numbers
+# * nums with no integer part (e.g. '.5')
+# * any radix number beyond most basic:
+#   - ratios: '0xfeed/0xf00d' or ':16(feed)/:16(f00d)'
+#   - nums:   ':16feed.f00d'
+#   - * base ** exp
+#   * Rakudo's grammar
+#   * val()
 # * Strengthen val()
-#   * Radix-notated Int
+#   * Check that number in ':30foo' radix notation is sane
+#   * Make parsing match Rakudo (and STD, where possible)
 #   * Make val() available globally
 # * $?USAGE
 #   * Create $?USAGE at compile time
 #   * Make $?USAGE available globally
 # * Command-line parsing
-#   * Like -- , first non-switch kills option parsing
-#   * Allow : as option indicator (: no spaces before argument?)
-#   * Single-dash options (don't allow spaces before argument)
 #   * Allow both = and space before argument of double-dash args
-#   * Non-Bool options that get negated become but False
 #   * Comma-separated list values
 #   * Allow exact Perl 6 forms, quoted away from shell
 # * Fix remaining 
@@ -25,26 +32,49 @@ my sub MAIN_HELPER($retval = 0) {
 # Convert to native type if appropriate
 my grammar CLIVal {
 token TOP { ^ numlike $ }
+
 token numlike {
 [
-| [\-+]? \d+ '/' [\-+]? \d+
-| [\-+]? \d+ '.' \d+ 'e' [\-+]? \d+
-| [\-+]? \d+ 'e' [\-+]? \d+
-| [\-+]? \d+ '.' \d+
-| [\-+]? \d+
+| [+\-]? decint '/' [+\-]? decint
+| [+\-]? decint '.' decint escale
+| [+\-]? decint  escale
+| [+\-]? decint '.' decint
+| [+\-]? integer
+| [+\-]? ':' \d+ '' alnumint ''
+| [+\-]? 'Inf'
+| 'NaN'
+]
+}
+
+token binint   { [ 0..1 ]+ [ _ [ 0..1 ]+ ]* }
+token octint   { [ 0..7 ]+ [ _ [ 0..7 ]+ ]* }
+token hexint   { [ 0..9 a..f A..F ]+ [ _ [ 0..9 a..f A..F ]+ ]* }
+token alnumint { [ 0..9 a..z A..Z ]+ [ _ [ 0..9 a..z A..Z ]+ ]* }
+token decint   { \d+ [ _ \d+ ]* }
+token escale   { [Ee] [+\-]? decint }
+
+token integer {
+[
+| 0 [ b '_'? binint
+| o '_'? octint
+| x '_'? hexint
+| d '_'? decint
+]
+| decint
 ]
 }
 };
 
 my $val;
-if   CLIVal.parse($v) { $val := +$v }
-else  { $val :=  $v }
-return $val if $val ~~ Str;
+if$v ~~ /^ 'Bool::'?'False' $/ { $val := Bool::False }
+elsif $v ~~ /^ 'Bool::'?'True'  $/ { $val := Bool::True  }
+elsif CLIVal.parse($v) { $val := +$v }
+else   { return $v   }
 
 # Mix in original stringifications
 my role orig-string[$orig] {
-method Str  { $orig.Str  }
-method gist { $orig.gist }
+multi method Str  (Mu:D:) { $orig.Str  }
+multi method gist (Mu:D:) { $orig.gist }
 };
 return $val but orig-string[$v];
 }
@@ -53,35 +83,26 @@ my sub MAIN_HELPER($retval = 0) {
 my sub process-cmd-args (@args is copy) {
 my (@positional-arguments, %named-arguments);
 while (@args) {
-my $passed_value = @args.shift;
-my $negate = False;
-if $passed_value.substr(0, 2) eq '--' {
-my $arg = $passed_value.substr(2);
-if $arg.substr(0, 1) eq '/' {
-$arg .= substr(1) ;
-$negate = True;
-}
+my $passed-value = @args.shift;
+if $passed-value ~~ /^ ( '--' | '-' | ':' ) ('/'?) (.+) $/ {
+my ($switch, $negate, $arg) = (~$0, ?((~$1).chars), ~$2);
 
-if $arg eq '' {
-@positional-arguments.push: @args.map: hack-val;
-last;
-} elsif

[perl #101474] [PATCH] DWIM better in orig-string role in MAIN_HELPER()

2011-10-17 Thread via RT
# New Ticket Created by  geo...@corp.sonic.net 
# Please include the string:  [perl #101474]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=101474 


Attached please find a patch that makes the orig-string role
in nom's MAIN_HELPER() DWIM a better.


-'f

From 8ee72bed73f6a13606d7ea6b6614d06fd04d12a6 Mon Sep 17 00:00:00 2001
From: Geoffrey Broadwell ge...@broadwell.org
Date: Sun, 16 Oct 2011 16:11:37 -0700
Subject: [PATCH] DWIM better in orig-string role in MAIN_HELPER()

In the first snapshot orig-string was too aggressive, and in the
second snapshot it was too conservative.  This middle ground seems
to DWIM better than either extreme did.
---
 src/core/Main.pm |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/core/Main.pm b/src/core/Main.pm
index 09cdbad..a6330e1 100644
--- a/src/core/Main.pm
+++ b/src/core/Main.pm
@@ -73,7 +73,7 @@ my sub MAIN_HELPER($retval = 0) {
 
 # Mix in original stringifications
 my role orig-string[$orig] {
-multi method Str  (Mu:D:) { $orig.Str  }
+  method Str  ()  { $orig.Str  }
 multi method gist (Mu:D:) { $orig.gist }
 };
 return $val but orig-string[$v];
-- 
1.7.4.1



Re: [perl #78626] Patch: support higher arity in reduce()

2011-10-13 Thread smosher

Hi,

That's fine, I think it was already shot down owing to the supposedly  
dubious utility of supporting higher arities in .reduce()


By the way, I submitted the patch because the error message had (and  
still has) the for now wording when you try any other arity. But  
after I submitted the patch I was asked to defend non-binary reduce.  
After scratching my head I might have replied with some mumblings  
about continued fractions or something, but I don't understand why I  
was asked while that particular wording is still in place—either it's  
binary only or it isn't, or perhaps it's just not specced.


I can appreciate the added complication in checking when a non-binary  
reduce should actually terminate, and other concerns. If I knew that  
the functionality was desired, I'd be happy to submit another patch.  
At the moment a change in the wording in src/core/List.pm might be  
advisable, line 296: fail('can only reduce with arity 2 for now'),  
dropping the for now if the functionality is not in fact desired.


Anyway, thanks for following up!

Best Regards,
Stephen Mosher

Quoting Will Coleda via RT perl6-bugs-follo...@perl.org:


On Wed Oct 27 00:22:05 2010, smosher wrote:


Hi,

Attached is a diff against rakudo/src/core/Any-list.pm which adds
   support to reduce() for higher-arity functions. It ensures arity-
   list agreement and is generally safe. Other than the  test, the
   functionality was already present... it  needed two lines commented
   out, two uncommented. Since tests passed and there were no
   explanatory comments in the file, jnthn suggested I mail in a diff.
   Here it is.

I was considering including another patch to support functions that
   reduce to more than a single term, but as it turns out this is best
   handled by using a [list] item instead.

Note: if the supplied function _does_ return more than a single term,
   reduce() will not produce a correct result (neither this version
   nor the original), but it will terminate assuming a finite list.

Regards,
Stephen



Unfortunately, this patch no longer applies against rakudo master,  
so I'm rejecting the ticket.


Thanks for trying to make rakudo more awesome!

--
Will Coke Coleda






Re: [perl #78626] Patch: support higher arity in reduce()

2011-10-13 Thread Moritz Lenz

Am 13.10.2011 06:01, schrieb smos...@loveandhotsauce.net:

That's fine, I think it was already shot down owing to the supposedly
dubious utility of supporting higher arities in .reduce()

By the way, I submitted the patch because the error message had (and
still has) the for now wording when you try any other arity. But after
I submitted the patch I was asked to defend non-binary reduce. After
scratching my head I might have replied with some mumblings about
continued fractions or something, but I don't understand why I was asked
while that particular wording is still in place—either it's binary only
or it isn't, or perhaps it's just not specced.

I can appreciate the added complication in checking when a non-binary
reduce should actually terminate, and other concerns. If I knew that the
functionality was desired, I'd be happy to submit another patch. At the
moment a change in the wording in src/core/List.pm might be advisable,
line 296: fail('can only reduce with arity 2 for now'), dropping the
for now if the functionality is not in fact desired.


Let me provide some context for the for now here. I'm not defending 
that phrase (and will remove it), just want to provide some food for 
thought.


Back when you wrote the patch, we did find higher arity reduce 
desirable, and I think some of us are still emotionally attached to the 
idea.


The problem is that the complexity of signatures makes it basically 
impossible to figure out which candidate to call if the reducer is a 
multi, and thus to decide how many arguments to pass.


The idea back then was to somhow specific a mechanism for supplying a 
(possibly lazy) stream of arguments to a set of multi candidates, and 
have the call eat up an apropriate amount of arguments. Such a mechansim 
would be useful in other places as well (such as 'for' and 'map' with 
blocks of higher arity), and it would be a very nice anaolgy to regexes. 
And like the famous longest token matching [1] in regexes, we'd expect 
such a mechanism to be mostly greedy, ie the candidate that binds the 
most arguments wins, unless other circumstances prevent that from 
happening (you see, it's rather vague).


I have no idea how feasible such a mechanism is, and if it will be 
included in Perl 6 at all. But I'm sure that if it will be defined, it 
will be on a much lower level than reduce -- probably in the multi 
dispatcher directly.


Up to now such a spec hasn't happened, but the idea keeps simmering in 
the back of the minds of several Perl 6 hackers.


Cheers,
Moritz


[perl #77412] [PATCH] Fix sub hash() and improve Parcel.hash

2011-10-08 Thread Will Coleda via RT
On Tue Aug 24 05:26:24 2010, TiMBuS wrote:
 This is just a followup fix to ticket #75584 that pmichaud was going 
to do
 but probably forgot about. Previously Parcel's hash method was 
delegating to
 sub hash (which is backwards). I flipped it around to fix it.

Whoops! we seem to have missed this patch, and the repository has 
changed enough that files in the patch are now gone.

If you feel this still needs patching, please throw us another one, and 
ping me on IRC if it doesn't get applied or commented on in a day.

Sorry, and thanks for trying to make rakudo better.

-- 
Will Coke Coleda


[perl #78152] [PATCH] Remove rakudo build dependency on shell/backticks and allow smoother windows (g|mingw32-)make spectest_smolder

2011-10-08 Thread Will Coleda via RT
On Sat Oct 02 03:23:18 2010, moritz wrote:
 Thanks for the patch, I've applied it.
 
 I'm leaving this ticket open for now, until we've decided what to do
 about the documentation.

Let's either add a Windows section to the main README, or a new 
README.win32.

I will happily apply such a patch!

-- 
Will Coke Coleda


[perl #75752] [PATCH] make realclean before svn update (parrot)

2011-10-04 Thread Will Coleda via RT
On Tue Jul 27 18:58:37 2010, coke wrote:
 On Tue Jun 15 00:11:43 2010, q...@cono.org.ua wrote:
  perl Configure.pl --gen-parrot failed time to time. Need to do
  realclean before update.
 
  diff --git a/build/gen_parrot.pl b/build/gen_parrot.pl
  index 63173a3..572f474 100644
  --- a/build/gen_parrot.pl
  +++ b/build/gen_parrot.pl
  @@ -43,12 +43,6 @@ close $REQ;
   }
   }
 
  -print Checking out Parrot r$reqsvn via svn...\n;
  -system_or_die(qw(svn checkout -r),  $reqsvn ,
  qw(https://svn.parrot.org/parrot/trunk parrot));
  -
  -chdir('parrot') || die Can't chdir to 'parrot': $!;
  -
  -
   ##  If we have a Makefile from a previous build, do a 'make
 realclean'
   if (-f 'Makefile') {
   my %config = read_parrot_config();
  @@ -59,6 +53,12 @@ if (-f 'Makefile') {
   }
   }
 
  +print Checking out Parrot r$reqsvn via svn...\n;
  +system_or_die(qw(svn checkout -r),  $reqsvn ,
  qw(https://svn.parrot.org/parrot/trunk parrot));
  +
  +chdir('parrot') || die Can't chdir to 'parrot': $!;
  +
  +
   print \nConfiguring Parrot ...\n;
   my @config_command = ($^X, 'Configure.pl', @ARGV);
   print @config_command\n;
 
 
 
 +1 on this patch (at least in spirit) from me, but I cannot apply it
 (probably because it was
 inlined in the ticket.) Can you add it as an attachment?
 
 Thanks!

Wow. Since this last comment, it's been over a year, I have a commit bit 
now, parrot has moved to git, and this patch doesn't apply cleanly 
anymore.

However, digging through the source of rakudo's --gen-parrot step, we 
are now realcleaning if a Makefile is present!

So, applied in spirit. Belatedly.

Thanks!

-- 
Will Coke Coleda


[perl #75818] [BUG] [PATCH] Zip operator Z should return a list of parcels

2011-10-04 Thread Will Coleda via RT
On Thu Jun 17 00:38:17 2010, ciphertext wrote:
 ciphertext: rakudo: (1,2,3 Z 4,5,6).perl.say
 p6eval: rakudo c9ee2e: OUTPUT«(1, 4, 2, 5, 3, 6)␤»
 ciphertext: rakudo: (1,2,3 Z[,] 4,5,6).perl.say
 p6eval: rakudo c9ee2e: OUTPUT«(1, 4, 2, 5, 3, 6)␤»
 pmichaud:  (1,2,3 Z[,] 4,5,6).perl.say
 pmichaud: ((1, 4), (2, 5), (3, 6))
 pmichaud: (in the new branch)
 ciphertext: pmichaud: that's what i'm getting, but the spec says that 
Z
 should be an alias for Z[,]
 ciphertext: The Z, operator is perhaps more clearly written as Z[,].
 However, this list form is common enough to have a shortcut, the 
ordinary
 infix Z operator described earlier.
 pmichaud: sounds like a rakudo bug to me then.
 
 Also from S03:
 
 1,2 Z 3,4   # (1,3),(2,4)

This appears to be working now:

08:45  [Coke] rakudo: (1,2,3 Z[,] 4,5,6).perl.say
08:45 +p6eval rakudo 7408d6: OUTPUT«((1, 4), (2, 5), (3, 6)).list␤»
08:45  [Coke] rakudo: (1,2,3 Z, 4,5,6).perl.say
08:45 +p6eval rakudo 7408d6: OUTPUT«((1, 4), (2, 5), (3, 6)).list␤»

There's a test in S03-metaops/zip.t to make sure this parses, but not to 
make sure it works.



-- 
Will Coke Coleda


[perl #67046] [PATCH] - implemented: not Object's method, and sign Num's method

2011-10-04 Thread Will Coleda via RT
On Fri Aug 13 13:55:11 2010, lithos wrote:
 .not and .so are still missing in current Rakudo:
 
 $ ./perl6
  True.so
 Method 'so' not found for invocant of class 'Bool'
  True.not
 Method 'not' not found for invocant of class 'Bool'
  1.so
 Method 'so' not found for invocant of class 'Int'
  1.not
 Method 'not' not found for invocant of class 'Int'
 
 
 This is Rakudo Perl 6, version 2010.07-113-gc41bcd7 built on parrot
 2.6.0 r48341
 
 
 #perl 2010-08-13
  should not be available as a method? there is a ticket about it, 
but I
 +don't find it in the spec
 masak lithos: I've always figured both .so and .not are available as
 +methods.
 masak I might be wrong, though.
 masak .so is mentioned in S12. from that I deduce by symmetry that 
.not
 +should be there too, even though it's not mentioned.
 
 
 (This is the ticket I was referring to in my question.)

Closer...

08:48  [Coke] rakudo: say True.so;
08:48 +p6eval rakudo 7408d6: OUTPUT«Bool::True␤»
08:48  [Coke] rakudo: say True.not;
08:48 +p6eval rakudo 7408d6: OUTPUT«Method 'not' not found for 
invocant of
class 'Bool'␤  in block anon at /tmp/8Na9f0JyUp:1␤  
in anon
at /tmp/8Na9f0JyUp:1␤␤»


-- 
Will Coke Coleda


[perl #78626] Patch: support higher arity in reduce()

2011-10-04 Thread Will Coleda via RT
On Wed Oct 27 00:22:05 2010, smosher wrote:
 
 Hi,
 
 Attached is a diff against rakudo/src/core/Any-list.pm which adds
support to reduce() for higher-arity functions. It ensures arity-
list agreement and is generally safe. Other than the  test, the
functionality was already present... it  needed two lines commented
out, two uncommented. Since tests passed and there were no
explanatory comments in the file, jnthn suggested I mail in a diff.
Here it is.
 
 I was considering including another patch to support functions that
reduce to more than a single term, but as it turns out this is best
handled by using a [list] item instead.
 
 Note: if the supplied function _does_ return more than a single term,
reduce() will not produce a correct result (neither this version
nor the original), but it will terminate assuming a finite list.
 
 Regards,
 Stephen
 

Unfortunately, this patch no longer applies against rakudo master, so I'm 
rejecting the ticket.

Thanks for trying to make rakudo more awesome!

-- 
Will Coke Coleda


[perl #64708] [PATCH] Implemented the slurp method to be invoked on Str file names

2011-10-03 Thread Will Coleda via RT
On Mon Apr 13 17:10:03 2009, nelo.ony...@googlemail.com wrote:
  Hi all,
 
 I hope this PATCH is correct. A couple of issues came up whilst I was
 working on this:
 
  Shouldn't we be able to return from within the try block?
According to http://www.rakudo.org/status these already work but I
 am not
 sure how CATCH blocks work
 
  Do file tests work yet?
I think a :e test would be better than a try block here
 
  HEREDOCS don't seem to work
Hence I used the IO::slurp in the tests ... which need work ;)
 
  Is the #{returns Array of Str} from
 
http://github.com/mattw/form/blob/9ec36b4c7b1bfde622ef14cb8d51ca15d12dbd01/lib/Form/Text
Formatting.pmcorrect
 or is that just a comment
I tried it and it works but I have not seen that sort of use
 anywhere
 else
 
 Please do let me know if I've made any errors in my implementation so
 I can
 note them for next time.
 
 Thanks.
 

Sorry about the delay:

Bad News: this patch no longer applies.

Good News: this seems to have been added already.

$ cat foo.pl
say line 1;
say line 2;
$ ./perl6 -e print slurp 'foo.pl'
say line 1;
say line 2;

Thank you very much for the patch - we're trying to improve our response time 
on 
tickets, please bear with us.


-- 
Will Coke Coleda


[perl #74008] [PATCH] Lazy assignation to Seq and Array

2011-09-30 Thread Will Coleda via RT
On Fri Apr 02 14:20:38 2010, jmarti wrote:
 This patch implements lazy assignation to Seq and Array objects.

Sorry about the delay in responding. While the patch no longer cleanly 
applies, it looks like this feature does exist in current rakudo:

19:58  [Coke] nom: my @range_a = 1..*; say alive; print 
@range_a[2344];
19:58 +p6eval nom ebd4d8: OUTPUT«alive␤2345»

Thanks for the patch, and again, sorry about the delay in responding!

-- 
Will Coke Coleda


[perl #63228] [PATCH] Support using $? variables and implement $?PROGRAM

2011-09-23 Thread Will Coleda via RT
On Fri Feb 13 21:50:40 2009, chrisdolan wrote:
 On Fri Feb 13 21:14:59 2009, ch...@chrisdolan.net wrote:
  This patch adds support for '?' twigil variables to actions.pm and  
  declares the $?PROGRAM read-only global variable in !UNIT_START.  The  
  value stored in that variable is first argument to Rakudo (e.g.  
  'prog.pl' or '-e') which previously was dropped on the floor when  
  creating @*ARGS.
  
 git pull git://github.com/chrisdolan/rakudo.git program-name
  
  t/spec/S02-magicals/progname.t updated to test this in r25324
 
 Larry changed the spec 5 minutes after I submitted this, so $?PROGRAM is
 no longer correct.  I think the actions.pm half of the patch is still
 right, though.
 

Very sorry, this patch seems to have gotten lost in RT, and even the part 
that wasn't specced out from under you no longer applies.

Thanks for the patch, we'll try to get to them faster in the future!

-- 
Will Coke Coleda


[perl #77066] [PATCH] Fix + speed up Hash!STORE method

2011-09-20 Thread Will Coleda via RT
Thank you very much for the patch, sorry for the delay in responding.

Unfortunately, the patch seems to be corrupt, (so says git apply), but 
recent changes on rakudo's nom branch hopefully have improved the 
situation you were trying to remedy here.

Thanks again.

-- 
Will Coke Coleda


[perl #73350] [PATCH] Add p5chomp and add p5chomp and p5chop to tests

2011-09-19 Thread Will Coleda via RT
Sorry about the delay in responding. Thanks for the patch.

These were removed from the spec in 

https://github.com/perl6/specs/commit/9538e55c7dbcadf6002a2b68b8baaf094f8af78d
-- 
Will Coke Coleda


[perl #73392] [PATCH] Fix parsing of overflowing numbers with exponent part

2011-09-19 Thread Will Coleda via RT
Sorry about the delay in responding.

These patches no longer apply, so I'm rejecting the ticket.

Thanks for the submittal, we do appreciate it, even if we're slow to respond.

-- 
Will Coke Coleda


[perl #75030] [PATCH] Lexical persistence autoprinting for the REPL

2011-09-19 Thread Will Coleda via RT
Closing ticket as resolved - I don't think we applied the original patch, but 
we have REPL 
autoprinting for some time now.

Thanks for the submission!

-- 
Will Coke Coleda


[perl #75686] [PATCH] - add limit definition to lines sub

2011-09-19 Thread Will Coleda via RT
Sorry it took so long, but, while the patch has bitrotted slightly and won't 
apply, it looks like we 
now have a limit arg anyway.

Thanks for the patches, we'll try to get faster in processing the backload!

-- 
Will Coke Coleda


[perl #75810] [PATCH] Multiple bug fixes (list branch)

2011-09-19 Thread Will Coleda via RT
On Wed Jun 16 09:05:34 2010, ciphertext wrote:
 Apply to branch list, commit ddb39d064c6e334f4d08
 Fixes these bugs:

Sorry, this branch has been deleted.

If these fixes are still relevant, we'd love a patch against the latest (nom) 
branch. Thanks, sorry 
for the delay in processing.

-- 
Will Coke Coleda


[perl #65120] [PATCH] Consistent semantics for slurp and lines subs

2011-09-11 Thread Ron Schmidt via RT
 Thanks for the patch ... unfortunately, this patch no longer cleanly
 applies. Can you rebase
 and re-submit? I'll leave the ticket open for a little while.
 
 Regards.

I don't know how long this has been true, but at this point $*IO.slurp 
and $fh.slurp work and that seems good enough.  Propose closing this 
ticket as resolved shortly if no objections.

Ron




[perl #93576] [PATCH] Allow (g|mingw32-)make t/spec/S02-builtin_data_types/anon_block.t (or any other test file) workable under Windows

2011-06-26 Thread via RT
# New Ticket Created by  Ron Schmidt 
# Please include the string:  [perl #93576]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=93576 


Under Linux if you are in the rakudo build directory and type make 
t/spec/S02-builtin_data_types/anon_block.t  (or make followed by the 
name of any test file) the test file is run with the right configuration 
and command line parameters to make #? skip and #? todo directives 
etc behave properly.  This currently does not seem to work on Windows.  
It doesn't work for me and after a discussion on IRC with JimmyZ, see 
http://irclog.perlgeek.de/perl6/2011-06-26#i_4005711, it became clear it 
didn't work for him on Windows either.

I have attached a patch that fixes the problem to the point of having 
such a command line request usable under windows.  The solution is 
somewhat lacking in that it doesn't allow the test file names provided 
to make to have the '\' back slash separators that are native to Windows 
but includes a comment in the make file to document around the issue.  
I hope and believe that the patch makes the situation better than it is 
now.  The patch takes out the translation of \* to \\* that, I believe, 
was intended to work around this at one point but after testing with 
gmake and strawberry Perl as well as mingw32-make and ActiveState Perl 
believe that the build and install  work properly without that 
translation and with this patch.

Hope this helps,
Ron Schmidt
diff --git a/Configure.pl b/Configure.pl
index 79c24af..b8467a2 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -181,7 +181,10 @@ sub create_makefile {
 $maketext =~ s/@(\w+)@/$config{$1}/g;
 if ($^O eq 'MSWin32') {
 $maketext =~ s{/}{\\}g;
-$maketext =~ s{\\\*}{*}g;
+$maketext =~ s{^\s*t\\\*.t .*}{
+my $t = $; $t =~ s!\\!/!g; 
+# under windows provide forward slashes on command line for single test file$/$t;
+}me;
 $maketext =~ s{(?:git|http):\S+}{ do {my $t = $; $t =~ s'\\'/'g; $t} }eg;
 $maketext =~ s/.*curl.*/do {my $t = $; $t =~ s'%'%%'g; $t}/meg;
 }


Re: [perl #63408] [PATCH] use PCT::HLLCompiler.addstage()

2011-05-16 Thread Chris
Yes, closeable. Thanks.
Chris

Tadeusz Sośnierz via RT perl6-bugs-follo...@perl.org wrote:

On Sun Feb 22 18:53:32 2009, ch...@chrisdolan.net wrote:  This trivial patch 
to perl6.pir changes Perl6::Compiler to use its  superclass' addstage() 
mutator instead of directly editing the  @stages attribute. This should make 
for better forward  compatibility, as it avoids repeating the list of stages. 
 https://github.com/rakudo/rakudo/blob/master/src/Perl6/Compiler.pir#L162 The 
current implementation seems to use addstage, is the ticket closable? 



Re: [perl #84362] [PATCH] Sequence operator supports limit function with arity 1

2011-02-27 Thread David Whipp
Thank you.

My github ID is dwhipp.


Dave.

On Fri, Feb 25, 2011 at 11:56 AM, Moritz Lenz via RT 
perl6-bugs-follo...@perl.org wrote:

 On Thu Feb 17 14:35:14 2011, dwh...@google.com wrote:
  Attached patches add tests and implementation for sequence operator with
  limit-function arity  1 (the function is assumed to be false until we
 have
  enough values to call it).

 Thank you for your patches, I've applied all three.

 If you tell me your github ID I can also give you commit access to roast
 (the spectest repo) and other repos under the 'perl6' organization.

 Cheers,
 Moritz



[perl #84950] [PATCH] Added basic IO functions

2011-02-27 Thread via RT
# New Ticket Created by  William Orr 
# Please include the string:  [perl #84950]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=84950 


rakudo didn't have the ability to rm, copy, move, chmod, or link files
even though the underlying VM supports it. I added support for all of
those functions, as well as adding the ability to get permissions
information from IO::Stat.

This patch was also submitted as a pull request on github.
From 581b99cdc23e474b8b4a8056328ecc013e32b754 Mon Sep 17 00:00:00 2001
From: William Orr w...@worrbase.com
Date: Thu, 24 Feb 2011 05:05:17 -0500
Subject: [PATCH] Added move to IO.pm

Added chmod

Can look at filesystem permissions

Removed unnecessary functions

- Didn't need all the stuff I wrote

Implemented copy

Added additional basic IO functions

- added rm
- added link

Turns outperl6 does support octal
---
 src/core/IO.pm  |   42 ++
 src/core/IO/Stat.pm |4 
 2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/core/IO.pm b/src/core/IO.pm
index d60eff5..12d1550 100644
--- a/src/core/IO.pm
+++ b/src/core/IO.pm
@@ -292,4 +292,46 @@ multi sub cwd() {
 $! ?? fail($!) !! $pwd;
 }
 
+multi sub move($src as Str, $dest as Str) {
+try {
+pir::new__PS('OS').rename($src, $dest);
+}
+$! ?? fail($!) !! True
+}
+
+multi sub chmod($path as Str, $mode as Int) {
+try {
+pir::new__PS('OS').chmod($path, $mode);
+}
+$! ?? fail($!) !! True
+}
+
+multi sub copy($src as Str, $dest as Str) {
+try {
+pir::new__PS('File').copy($src, $dest);
+}
+$! ?? fail($!) !! True
+}
+
+multi sub rm($path as Str) {
+try { 
+pir::new__PS('OS').rm($path);
+}
+$! ?? fail($!) !! True
+}
+
+multi sub link($src as Str, $dest as Str, Bool :$hard = False) {
+if $hard {
+try {
+pir::new__PS('OS').link($src, $dest);
+}
+$! ?? fail($!) !! return True;
+}
+
+try {
+pir::new__PS('OS').symlink($src, $dest);
+}
+$! ?? fail($!) !! True
+}
+
 # vim: ft=perl6
diff --git a/src/core/IO/Stat.pm b/src/core/IO/Stat.pm
index dba9c86..95ab65d 100644
--- a/src/core/IO/Stat.pm
+++ b/src/core/IO/Stat.pm
@@ -44,6 +44,10 @@ class IO::Stat {
 method gid {
 pir::stat__isi($.path, 10);
 }
+
+method permissions {
+pir::stat__isi($.path, -3) + 0o;
+}
 }
 
 # vim: ft=perl6
-- 
1.7.4.1



[perl #84966] [PATCH] Added file test methods to IO.pm

2011-02-27 Thread via RT
# New Ticket Created by  William Orr 
# Please include the string:  [perl #84966]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=84966 


I implemented several of the file test methods listed here:
https://github.com/perl6/specs/blob/master/S32-setting-library/IO.pod

Additionally, I reimplemented IO.l in Perl6 rather than pir, and I
changed the behaviour of IO.f so that it actually matched the spec
(devices aren't normal files).

Patch also submitted as github pull request.
From ef513564a171d724d602216e48f235779753d509 Mon Sep 17 00:00:00 2001
From: William Orr w...@worrbase.com
Date: Fri, 25 Feb 2011 23:44:27 -0500
Subject: [PATCH] Added nodev requirement to IO.f

- spec says that regular files can be neither devices or directories

Added R(), W(), X()

Added O() and o()

Changed IO.l implementation to Perl6 instead of pir

Implemented u() g() and k()
---
 src/core/IO.pm |   60 +--
 1 files changed, 49 insertions(+), 11 deletions(-)

diff --git a/src/core/IO.pm b/src/core/IO.pm
index 12d1550..f1b91ab 100644
--- a/src/core/IO.pm
+++ b/src/core/IO.pm
@@ -147,26 +147,64 @@ class IO is Cool {
 $.stat.exists;
 }
 multi method f() {
-self.e ?? !$.stat.isdir !! Bool;
+self.e ?? (!$.stat.isdir and !$.stat.isdev) !! Bool;
 }
 
 multi method s() {
 self.e ?? $.stat.size !! Any;
 }
 
+multi method R() {
+?pir::new__PS('OS').can_read($.path);
+}
+
+multi method W() {
+?pir::new__PS('OS').can_write($.path);
+}
+
+multi method X() {
+?pir::new__PS('OS').can_execute($.path);
+}
+
+# These are clones of the above functions since parrot can't determine
+# the effective uid yet
+multi method r() {
+?pir::new__PS('OS').can_read($.path);
+}
+
+multi method w() {
+?pir::new__PS('OS').can_write($.path);
+}
+
+multi method x() {
+?pir::new__PS('OS').can_execute($.path);
+}
+
 multi method l() {
-my $fn = $.path;
-? Q:PIR{
-.local pmc filename, file
-filename = find_lex '$fn'
-$S0 = filename
-
-file = root_new ['parrot';'File']
-$I0 = file.'is_link'($S0)
-%r = box $I0
-}
+$.stat.islnk;
+}
+
+multi method O() {
+pir::new__PS('OS').get_user_id() ~~ $.stat.uid;
 }
 
+# Can't get effective uid in parrot
+multi method o() {
+pir::new__PS('OS').get_user_id() ~~ $.stat.uid;
+}
+
+	multi method u() {
+		?($.stat.permissions + 0o4000);
+	}
+
+	multi method g() {
+		?($.stat.permissions + 0o2000);
+	}
+
+	multi method k() {
+		?($.stat.permissions + 0o1000);
+	}
+
 multi method z() {
 $.e  $.s == 0;
 }
-- 
1.7.3.4



[perl #84948] [PATCH] Fixed most IO::Stat functions

2011-02-27 Thread via RT
# New Ticket Created by  William Orr 
# Please include the string:  [perl #84948]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=84948 


Parrot introduced some changes which broke most of the functions in
IO::Stat. I fixed them, and added two new functions (isdev, islnk)
that parrot implemented.

This patch was also sent as a pull request on github.

-- 
-Will Orr
From 57e34fc2d268134f992b72887acdfb72ec81768a Mon Sep 17 00:00:00 2001
From: William Orr w...@worrbase.com
Date: Fri, 25 Feb 2011 19:23:07 -0500
Subject: [PATCH] Fixed some stat bugs

- added isreg
- added islnk
- fixed all IO::Stat methods with intval  2
---
 src/core/IO/Stat.pm |   24 
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/core/IO/Stat.pm b/src/core/IO/Stat.pm
index dba9c86..2578498 100644
--- a/src/core/IO/Stat.pm
+++ b/src/core/IO/Stat.pm
@@ -13,36 +13,44 @@ class IO::Stat {
 ?pir::stat__isi($.path, 2);
 }
 
-method isdev {
+method isreg {
 ?pir::stat__isi($.path, 3);
 }
 
+method isdev {
+?pir::stat__isi($.path, 4);
+}
+
 method createtime {
-pir::stat__isi($.path, 4);
+pir::stat__isi($.path, 5);
 }
 
 method accesstime {
-pir::stat__isi($.path, 5);
+pir::stat__isi($.path, 6);
 }
 
 method modifytime {
-pir::stat__isi($.path, 6);
+pir::stat__isi($.path, 7);
 }
 
 method changetime {
-pir::stat__isi($.path, 7);
+pir::stat__isi($.path, 8);
 }
 
 method backuptime {
-pir::stat__isi($.path, 8);
+pir::stat__isi($.path, 9);
 }
 
 method uid {
-pir::stat__isi($.path, 9);
+pir::stat__isi($.path, 10);
 }
 
 method gid {
-pir::stat__isi($.path, 10);
+pir::stat__isi($.path, 11);
+}
+
+method islnk {
+?pir::stat__isi($.path, 12);
 }
 }
 
-- 
1.7.4.1



Re: [perl #84362] AutoReply: [PATCH] Sequence operator supports limit function with arity 1

2011-02-25 Thread David Whipp
One extra patch for this change: an error if the limit-function is a multi
(not sure if you'll want to apply this as-is: I couldn't figure out why
fail didn't result in an error. so used die, instead).

On Thu, Feb 17, 2011 at 2:35 PM, perl6 via RT
perl6-bugs-follo...@perl.orgwrote:

 Greetings,

 This message has been automatically generated in response to the
 creation of a trouble ticket regarding:
[PATCH] Sequence operator supports limit function with arity  1,
 a summary of which appears below.

 There is no need to reply to this message right now.  Your ticket has been
 assigned an ID of [perl #84362].

 Please include the string:

 [perl #84362]

 in the subject line of all future correspondence about this issue. To do
 so,
 you may reply to this message.

Thank you,
perl6-bugs-follo...@perl.org

 -
 Attached patches add tests and implementation for sequence operator with
 limit-function arity  1 (the function is assumed to be false until we have
 enough values to call it). The tests show how this can be used to terminate
 a sequence when it converges, or when a specific curvature is seen:

  1, */2 ... abs(*-*)  0.01;## convergence: 8 values
  0,1,2,1,0,1,2 ...^ { $^a-$^b  $^b-$^c };  ## curvature: 5 values
  1,2 ... { @_ == 4 };   ## length: 4 values


From 2312784b7a147bf2613b3e95f5ae37ed8dbbccaa Mon Sep 17 00:00:00 2001
From: Dave Whipp dwh...@google.com
Date: Fri, 25 Feb 2011 09:27:03 -0800
Subject: [PATCH] add error for use of Multi as sequence limit

---
 src/core/operators.pm |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/core/operators.pm b/src/core/operators.pm
index 074db9f..980a86e 100644
--- a/src/core/operators.pm
+++ b/src/core/operators.pm
@@ -401,7 +401,7 @@ our sub _HELPER_generate-series(@lhs, $rhs , :$exclude-limit) {
 my $limit = ($rhs ~~ Whatever ?? Any !! $rhs);
 return infinite-series(@lhs , $limit) if $rhs ~~ Whatever; #shortcut infinite series so we avoid the comparisions
 
-#fail ('Limit arity cannot be larger than 1') if   $limit ~~ Code  $limit.count  1;
+die 'Sequence limit cannot be a multi-sub or multi-method' if $limit ~~ Multi;
 my $series = infinite-series(@lhs , $limit);
 
 gather {
-- 
1.7.3.1



[perl #84362] [PATCH] Sequence operator supports limit function with arity 1

2011-02-18 Thread via RT
# New Ticket Created by  David Whipp 
# Please include the string:  [perl #84362]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=84362 


Attached patches add tests and implementation for sequence operator with
limit-function arity  1 (the function is assumed to be false until we have
enough values to call it). The tests show how this can be used to terminate
a sequence when it converges, or when a specific curvature is seen:

  1, */2 ... abs(*-*)  0.01;## convergence: 8 values
  0,1,2,1,0,1,2 ...^ { $^a-$^b  $^b-$^c };  ## curvature: 5 values
  1,2 ... { @_ == 4 };   ## length: 4 values
From 608d6c1dc96b81e0537d670d9949451c227f5708 Mon Sep 17 00:00:00 2001
From: Dave Whipp dwh...@google.com
Date: Thu, 17 Feb 2011 12:08:45 -0800
Subject: [PATCH] tests of sequence operator with limit function having arity  1

---
 S03-sequence/limit-arity-2-or-more.t |   37 ++
 1 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 S03-sequence/limit-arity-2-or-more.t

diff --git a/S03-sequence/limit-arity-2-or-more.t b/S03-sequence/limit-arity-2-or-more.t
new file mode 100644
index 000..5524ea8
--- /dev/null
+++ b/S03-sequence/limit-arity-2-or-more.t
@@ -0,0 +1,37 @@
+use v6;
+use Test;
+
+# LS03/List infix precedence/the sequence operator
+
+plan 8;
+
+# sequence with a limit function of arity 2
+
+is (8,*/2 ... abs(*-*)  2).join(', '), '8, 4, 2, 1', 'arity-2 convergence limit';
+is (8,*/2 ...^ abs(*-*)  2).join(', '), '8, 4, 2', 'arity-2 excluded convergence limit';
+
+# sequence with a limit function of arity 3
+
+{
+  my $i = -5;
+  my @seq = { ++$i; $i**3-9*$i } ... { ($^a-$^b)  ($^b-$^c) };
+  is @seq.join(', '), '-28, 0, 10, 8, 0, -8, -10', 'arity-3 curvature limit';
+}
+
+{
+  my $i = -5;
+  my @seq = { ++$i; $i**3-9*$i } ...^ { ($^a-$^b)  ($^b-$^c) };
+  is @seq.join(', '), '-28, 0, 10, 8, 0, -8', 'arity-3 excluded curvature limit';
+}
+
+# limit functions that limit sequence exactly at arity limit
+
+is (2, 1, 0.5 ... abs(*-*)  2).join(', '), '2, 1', 'ASAP arity-2 convergence limit';
+is (2, 1, 0.5 ...^ abs(*-*)  2).join(', '), '2', 'ASAP arity-2 excluded convergence limit';
+
+# limit function that accepts any number of args
+
+is (1 ... { @_ eq 1 2 3 }).join(', '), '1, 2, 3', 'arity-Inf limit';
+is (1 ...^ { @_ eq 1 2 3 }).join(', '), '1, 2', 'arity-Inf excluded limit';
+
+done;
-- 
1.7.3.1

From de547c7c44810e1cd8d03c023cc380498bff6301 Mon Sep 17 00:00:00 2001
From: Dave Whipp dwh...@google.com
Date: Thu, 17 Feb 2011 12:07:27 -0800
Subject: [PATCH] Sequence operator supports limit functions with arity  1

---
 src/core/operators.pm |   30 ++
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/core/operators.pm b/src/core/operators.pm
index c92e9f2..074db9f 100644
--- a/src/core/operators.pm
+++ b/src/core/operators.pm
@@ -401,16 +401,30 @@ our sub _HELPER_generate-series(@lhs, $rhs , :$exclude-limit) {
 my $limit = ($rhs ~~ Whatever ?? Any !! $rhs);
 return infinite-series(@lhs , $limit) if $rhs ~~ Whatever; #shortcut infinite series so we avoid the comparisions
 
-fail ('Limit arity cannot be larger than 1') if 	$limit ~~ Code  $limit.count  1;
+#fail ('Limit arity cannot be larger than 1') if   $limit ~~ Code  $limit.count  1;
 my $series = infinite-series(@lhs , $limit);
+
 gather {
-while $series {
-my $val = $series.shift();
-if $val ~~  $limit {
-take $val unless $exclude-limit ;
-last ;
-};
-take $val;
+if $limit ~~ Code  $limit.count  1 {
+my @limit-args;
+while $series {
+@limit-args.shift if @limit-args == $limit.count;
+my $val = $series.shift;
+@limit-args.push($val);
+my $done = @limit-args = $limit.arity  $limit(|@limit-args);
+take $val unless $done  $exclude-limit;
+last if $done;
+}
+}
+else {
+while $series {
+my $val = $series.shift();
+if $val ~~ $limit {
+take $val unless $exclude-limit ;
+last ;
+};
+take $val;
+}
 }
 }
 }
-- 
1.7.3.1



Re: [perl #83498] [PATCH] for #82142:

2011-02-08 Thread anteusz

2011.02.07. 11:36 keltezéssel, Moritz Lenz via RT írta:

And as an actual patch:

--- a/src/Perl6/Grammar.pm
+++ b/src/Perl6/Grammar.pm
@@ -1477,6 +1477,7 @@ token quote:syms  {
   }
   .setup_quotepairs
   [
+| '/' \s* '/'.panic: Null regex in substitution not allowed
   | '/'p6regex=.LANG('Regex','nibbler')  ?[/]  quote_EXPR:
':qq'  .old_rx_mods?
   | '['p6regex=.LANG('Regex','nibbler')  ']'
 .ws  [ '=' ||.panic: Missing assignment operator  ]

But I fear this is the wrong approach. Instead of doing a separate null
pattern check in every quoting construct, the check should be done in
the regex parsing code once, as STD.pm6 does it.

But I'll leave the final say to pmichaud or jnthn.

Cheers,
Moritz




Note , this approach has been used already in the same grammar.pm. If 
you search for  Null regex, you will find it.


Jaffa4




Re: [perl #83498] [PATCH] for #82142:

2011-02-07 Thread Moritz Lenz

And as an actual patch:

--- a/src/Perl6/Grammar.pm
+++ b/src/Perl6/Grammar.pm
@@ -1477,6 +1477,7 @@ token quote:syms {
 }
 .setup_quotepairs
 [
+| '/' \s* '/' .panic: Null regex in substitution not allowed
 | '/' p6regex=.LANG('Regex','nibbler') ?[/] quote_EXPR: 
':qq' .old_rx_mods?

 | '[' p6regex=.LANG('Regex','nibbler') ']'
   .ws [ '=' || .panic: Missing assignment operator ]

But I fear this is the wrong approach. Instead of doing a separate null 
pattern check in every quoting construct, the check should be done in 
the regex parsing code once, as STD.pm6 does it.


But I'll leave the final say to pmichaud or jnthn.

Cheers,
Moritz


Re: [perl #83498] [PATCH] for #82142:

2011-02-07 Thread Patrick R. Michaud
On Mon, Feb 07, 2011 at 11:36:22AM +0100, Moritz Lenz wrote:
 +| '/' \s* '/' .panic: Null regex in substitution not allowed
 
 But I fear this is the wrong approach. Instead of doing a separate
 null pattern check in every quoting construct, the check should be
 done in the regex parsing code once, as STD.pm6 does it.

I completely agree; the check for null regex needs to be done in the 
regex parsing code.  In particular, the following regex should also 
produce a null pattern exception of some sort, which the patch
doesn't address:

/ abc | | def /

Patch rejected; thanks for submitting!

Pm


[perl #73148] PATCH Fix bug #68752, make perl6 --version more informative

2011-02-01 Thread Will Coleda via RT
On Sun Jan 30 22:57:36 2011, coke wrote:
 On Fri Jun 11 05:09:26 2010, quester wrote:
  Updated the perl6 --version patch again for the Erlangen/May
 release.
  (Also redid git format-patch since there have been more changes in
  build/Makefile.in.)
 
 
 
 Looks like this style of output was not included, but we currently
 get:
 
 $ perl6 --version
 
 This is Rakudo Perl 6, version 2011.01-13-gfcc46ea built on parrot
 3.0.0 RELEASE_3_0_0-
 350-g814a916
 
 Copyright 2008-2011, The Perl Foundation
 
 .. which looks pretty good to me. (has the date of the last release,
 the git-describe string, the
 parrot build info...
 
 Can we (gently) reject the patch and close the ticket?
 

No complaints from pmichaud or sorear.

-- 
Will Coke Coleda


[perl #73148] PATCH Fix bug #68752, make perl6 --version more informative

2011-01-30 Thread Will Coleda via RT
On Fri Jun 11 05:09:26 2010, quester wrote:
 Updated the perl6 --version patch again for the Erlangen/May release.
 (Also redid git format-patch since there have been more changes in
 build/Makefile.in.)
 
 

Looks like this style of output was not included, but we currently get:

$ perl6 --version

This is Rakudo Perl 6, version 2011.01-13-gfcc46ea built on parrot 3.0.0 
RELEASE_3_0_0-
350-g814a916

Copyright 2008-2011, The Perl Foundation

.. which looks pretty good to me. (has the date of the last release, the 
git-describe string, the 
parrot build info...

Can we (gently) reject the patch and close the ticket?


-- 
Will Coke Coleda


[perl #82362] proposed README patch

2011-01-19 Thread via RT
# New Ticket Created by  Michael Stevens 
# Please include the string:  [perl #82362]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=82362 


See attached.
From 1cca0f3dd0c4aa55114eb33f3982a8109e2b9af2 Mon Sep 17 00:00:00 2001
From: Michael Stevens mstev...@etla.org
Date: Mon, 17 Jan 2011 21:38:07 +
Subject: [PATCH] Remove extra to in README.

---
 README |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/README b/README
index d0fe100..8a0ff24 100644
--- a/README
+++ b/README
@@ -29,7 +29,7 @@ See http://wiki.github.com/rakudo/rakudo/whats-going-into-rakudo for a list
 of modules we want included in the distribution.
 
 The skel/ directory contains the basic layout of documentation and
-other support files, other components are then populated into to
+other support files, other components are then populated into
 the target directory via the make command above.
 
 To create a candidate release tarball, try make release VERSION=.mm.
-- 
1.7.1



Re: [perl #82312] [PATCH] optimized Range for getting its size if its a numeric range

2011-01-19 Thread Gilbert Röhrbein
On Mo, 2011-01-17 at 13:34 -0800, Moritz Lenz via RT wrote:
 On 01/16/2011 07:47 PM, Gilbert R. Roehrbein (via RT) wrote:
  fixes the problem which you encounter when you try to evaluate
  +(23..23)
 
 ... and creates others. Consider
 
 (0..^3.3).Numeric
 
 Where you patch makes it return 3, but 4 is the correct answer.

shame :( but fixed it ^^

 Maybe checking for ~~ Int instead of ~~ Numeric helps, but we also need
 to more tests.

does now work for following ranges

for $(^3.3), $(0..3), $(-2..0), $(-2.9..3.1), $(1.9..3.1) {
my $a := +$_;
my $b := .elems;
say {.perl}\t\t$a != $b if $a != $b;
}
diff --git a/src/core/Range.pm b/src/core/Range.pm
index fc1395b..baffe3f 100644
--- a/src/core/Range.pm
+++ b/src/core/Range.pm
@@ -103,6 +103,16 @@ class Range is Iterable does Positional {
 multi method roll(Whatever) {
 self.roll(Inf);
 }
+
+# to optimize the calculation of the size of a big range
+# +(42..$big) doesnt take too much time now
+multi method Numeric () {
+nextsame unless $.max ~~ Numeric and $.min ~~ Numeric;
+my $lo := $.min + $.excludes_min;
+return 0 if $.max  $lo;
+my $ret := ($.max - $lo + 1).floor;
+return $ret - ($.excludes_max and $.max == $lo + $ret);
+}
 }
 
 


signature.asc
Description: This is a digitally signed message part


[perl #82362] proposed README patch

2011-01-19 Thread Will Coleda via RT
Thanks, applied as 0fc520e

-- 
Will Coke Coleda


[perl #82312] [PATCH] optimized Range for getting its size if its a numeric range

2011-01-17 Thread via RT
# New Ticket Created by  Gilbert R. Roehrbein 
# Please include the string:  [perl #82312]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=82312 


fixes the problem which you encounter when you try to evaluate
+(23..23)

~ payload


From b5d95340a193df9af8ccb185c33ef4177a7ab527 Mon Sep 17 00:00:00 2001

From: payload payl...@lavabit.com

Date: Sun, 16 Jan 2011 19:33:04 +0100

Subject: [PATCH] optimized Range for getting its size if its a numeric range



---

 src/core/Range.pm |   10 ++

 1 files changed, 10 insertions(+), 0 deletions(-)



diff --git a/src/core/Range.pm b/src/core/Range.pm

index fc1395b..8a07b53 100644

--- a/src/core/Range.pm

+++ b/src/core/Range.pm

@@ -103,6 +103,16 @@ class Range is Iterable does Positional {

 multi method roll(Whatever) {

 self.roll(Inf);

 }

+

+# to optimize the calculation of the size of a big range

+# +(42..$big) doesnt take too much time now

+multi method Numeric () {

+nextsame unless $.max ~~ Numeric and $.min ~~ Numeric;

+my $lo := $.min + $.excludes_min;

+my $hi := $.max - $.excludes_max;

+return 0 if $hi  $lo;

+return ($hi - $lo + 1).floor;

+}

 }

 

 

-- 

1.7.1





signature.asc
Description: PGP signature


Re: [perl #82312] [PATCH] optimized Range for getting its size if its a numeric range

2011-01-17 Thread Moritz Lenz
On 01/16/2011 07:47 PM, Gilbert R. Roehrbein (via RT) wrote:
 fixes the problem which you encounter when you try to evaluate
 +(23..23)

... and creates others. Consider

(0..^3.3).Numeric

Where you patch makes it return 3, but 4 is the correct answer.

Maybe checking for ~~ Int instead of ~~ Numeric helps, but we also need
to more tests.

Cheers,
Moritz


[perl #80474] [PATCH] Fix RT #80256, Can't curry * ! $n in Rakudo

2010-12-10 Thread via RT
# New Ticket Created by  Tomoki Aonuma 
# Please include the string:  [perl #80474]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=80474 


http://irclog.perlgeek.de/perl6/2010-12-05#i_3059071
 uasi rakudo: say 1, 2 ... *  3
 p6eval rakudo : OUTPUT«1234␤»
 uasi say 1, 2 ... * ! 3
 uasi rakudo: say 1, 2 ... * ! 3
 p6eval rakudo : OUTPUT«Can't take numeric value for object of type
 Whatever [...]
 uasi :/
 masak huh.
 * masak submits rakudobug
 masak must be some unfortunate combination of ! and operator currying.

This patch fixes that meta-infix currying problem.

Was:

% perl6 -v

This is Rakudo Perl 6, version 2010.11-15-gfedc117 built on parrot
2.10.1 RELEASE_2_10_1-679-g9bec614

Copyright 2008-2010, The Perl Foundation

% perl6
 * R+ 42
Can't take numeric value for object of type Whatever

Now:

% perl6
 * R+ 42
_block89
 (* R+ 42)(1)
43
 infix:+(*, 42)
Can't take numeric value for object of type Whatever

infix:+(*, 42) doesn't autocurry as jnthn mentioned:

http://irclog.perlgeek.de/perl6/2010-12-06#i_3062969
 masak whoa! uasi++ seems to have fixed RT #80256: 
 http://twitter.com/uasi/status/11907116134563840
...
 jnthn masak: I fear it may end up auto-currying infix:+(*, 42)

Hope this helps,
Tomoki Aonuma (uasi)


whatever_curry.patch
Description: Binary data


whatever.t.patch
Description: Binary data


[perl #78214] [PATCH] Allow more windows environments with git to work correctly with build process

2010-11-29 Thread Ron Schmidt via RT
 One of the patches here, the one for root.in, is actually a one line 
 patch to a Parrot file.  After this ticket is open, unless there are 
 objections,  I will open a Parrot trac ticket and cross reference the 
 two patch tickets.

The Parrot ticket was created and the related patch has been applied to 
Parrot closing the ticket.  The (closed) Parrot ticket is #1865 
(http://trac.parrot.org/parrot/ticket/1865).  Parrot has also now moved 
to git simplifying the patch for Rakudo needed to get the intended 
result.  I have attached the new set of patches as a single file for 
convenience - win32_cmd_line_git.patch.




win32_cmd_line_git.patch
Description: Binary data


Re: [PATCH] typo fix for spec S05

2010-11-22 Thread Moritz Lenz



Am 22.11.2010 08:39, schrieb Hongwen Qiu:


 -argument vary faster than the left.  In other words, C and C|| 
establish
 +argument very faster than the left.  In other words, C and C|| 
establish


Although it looks like a typo, to vary is indeed the correct verb here 
(means as much as changes or oscillates).


Cheers,
Moritz


Re: [PATCH] typo fix for spec S05

2010-11-22 Thread Hongwen Qiu

On 11/22/2010 04:01 PM, Moritz Lenz wrote:

Although it looks like a typo, to vary is indeed the correct verb here

I'm not a native English speaker, so sorry for the noise.


[PATCH] typo fix for spec S05

2010-11-21 Thread Hongwen Qiu


From 110a2564bc622c3b5ed659d049f99baf2e1a7dbf Mon Sep 17 00:00:00 2001
From: Hongwen Qiu qiuhong...@gmail.com
Date: Mon, 22 Nov 2010 15:32:47 +0800
Subject: [PATCH] [S05] typo fix.

---
 S05-regex.pod |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/S05-regex.pod b/S05-regex.pod
index 67c98e6..92b4826 100644
--- a/S05-regex.pod
+++ b/S05-regex.pod
@@ -742,7 +742,7 @@ procedural; it allows the compiler and/or the
 run-time system to decide which parts to evaluate first, and it is
 erroneous to assume either order happens consistently.  The C
 form guarantees left-to-right order, and backtracking makes the right
-argument vary faster than the left.  In other words, C and C|| establish
+argument very faster than the left.  In other words, C and C|| establish
 sequence points.  The left side may be backtracked into when backtracking
 is allowed into the construct as a whole.
 
-- 
1.7.3.2



[PATCH] [t] [S05] change one test for :state declaration, which supposed to fail.

2010-11-21 Thread Hongwen Qiu
I suppose DeclaratorTest1.parse('c3') should be OK, so change it to 
DeclaratorTest1.parse('c4').
From 1dc270aa5a7927b21c2076c8d20e10d5027b044e Mon Sep 17 00:00:00 2001
From: Hongwen Qiu qiuhong...@gmail.com
Date: Mon, 22 Nov 2010 15:42:34 +0800
Subject: [PATCH] [S05] change one test for :state declaration, which supposed 
to fail.

---
 S05-modifier/my.t |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/S05-modifier/my.t b/S05-modifier/my.t
index f30d46b..dcd93c9 100644
--- a/S05-modifier/my.t
+++ b/S05-modifier/my.t
@@ -43,7 +43,7 @@ is ~$/, 'c1', ':state in regex ($/) (1)';
 
 ok DeclaratorTest1.parse('c2'), ':state in regex (match) (2)';
 is ~$/, 'c2', ':state in regex ($/) (2)';
-ok !DeclaratorTest1.parse('c3'), ':state in regex (no match)';
+ok !DeclaratorTest1.parse('c4'), ':state in regex (no match)';
 
 ok DeclaratorTest1.parse('dzho'), ':our in regex (match)';
 is ~$/, 'dzho', ':our in regex ($/)';
-- 
1.7.3.2



RE: [perl #78626] Patch: support higher arity in reduce()

2010-10-30 Thread s mosher



 Subject: Re: [perl #78626] Patch: support higher arity in reduce()
 From: perl6-bugs-follo...@perl.org
 To: smosh...@hotmail.com
 Date: Thu, 28 Oct 2010 12:10:30 -0700
 
 Patrick R. Michaud wrote:
  On Wed, Oct 27, 2010 at 08:55:36PM -0700, Darren Duncan wrote:
  Stephen Mosher (via RT) wrote:
  Attached is a diff against rakudo/src/core/Any-list.pm which adds support 
  to
  reduce() for higher-arity functions. It ensures arity-list agreement and 
  is
  generally safe. Other than the  test, the functionality was already
  present... it  needed two lines commented out, two uncommented. Since 
  tests
  passed and there were no explanatory comments in the file, jnthn 
  suggested I
  mail in a diff. Here it is.
  What is a common or fundamentally important example of an N-adic
  function whose base operation takes 3 or more operands, such that
  reduce() would be useful?
  
  At one point we had the higher-arity capability in reduce(), and then
  took it out because it didn't seem to make much sense.  So, I agree with
  Darren that we need to see a use case or example (or otherwise some
  approval in the spec) before we restore this capability.
 
 I can say that if the desire is to have reduce() wrap a function with 2 main 
 parameters (which the elements of the input list go to) plus 1..N extra 
 configuration parameters, then that can be handily dealt with by using a 
 curried 
 version of the base function that supplies the config params, so that then 
 there 
 are just 2 params left for reduce() to work with as usual.
 
 While I throw that out there, I'm assuming that the higher-arity subject here 
 is 
 about taking 3 or more elements of the input list at once to feed the 
 function, 
 and its not about config params.
 
 Do any meta-operator syntaxes let you define the base function inline such as 
 if 
 it would be a closure, or do they rightly only work for pre-defined symbols 
 and 
 you'd have to use a foo() format version of reduce for anything more 
 complicated?
 
 -- Darren Duncan
 
 

Hi,

I was using it for a continued fraction reduction... something like 
(@array,0).reverse.reduce({$^c/($^b+$^a)}); where the fraction is not in 
...+1/x form. I would expect to run into other cases too.

Regards,
Stephen

  

Re: [perl #78626] Patch: support higher arity in reduce()

2010-10-28 Thread Patrick R. Michaud
On Wed, Oct 27, 2010 at 08:55:36PM -0700, Darren Duncan wrote:
 Stephen Mosher (via RT) wrote:
 Attached is a diff against rakudo/src/core/Any-list.pm which adds support to
 reduce() for higher-arity functions. It ensures arity-list agreement and is
 generally safe. Other than the  test, the functionality was already
 present... it  needed two lines commented out, two uncommented. Since tests
 passed and there were no explanatory comments in the file, jnthn suggested I
 mail in a diff. Here it is.
 
 What is a common or fundamentally important example of an N-adic
 function whose base operation takes 3 or more operands, such that
 reduce() would be useful?

At one point we had the higher-arity capability in reduce(), and then
took it out because it didn't seem to make much sense.  So, I agree with
Darren that we need to see a use case or example (or otherwise some
approval in the spec) before we restore this capability.

Pm


Re: [perl #78626] Patch: support higher arity in reduce()

2010-10-28 Thread Darren Duncan

Patrick R. Michaud wrote:

On Wed, Oct 27, 2010 at 08:55:36PM -0700, Darren Duncan wrote:

Stephen Mosher (via RT) wrote:

Attached is a diff against rakudo/src/core/Any-list.pm which adds support to
reduce() for higher-arity functions. It ensures arity-list agreement and is
generally safe. Other than the  test, the functionality was already
present... it  needed two lines commented out, two uncommented. Since tests
passed and there were no explanatory comments in the file, jnthn suggested I
mail in a diff. Here it is.

What is a common or fundamentally important example of an N-adic
function whose base operation takes 3 or more operands, such that
reduce() would be useful?


At one point we had the higher-arity capability in reduce(), and then
took it out because it didn't seem to make much sense.  So, I agree with
Darren that we need to see a use case or example (or otherwise some
approval in the spec) before we restore this capability.


I can say that if the desire is to have reduce() wrap a function with 2 main 
parameters (which the elements of the input list go to) plus 1..N extra 
configuration parameters, then that can be handily dealt with by using a curried 
version of the base function that supplies the config params, so that then there 
are just 2 params left for reduce() to work with as usual.


While I throw that out there, I'm assuming that the higher-arity subject here is 
about taking 3 or more elements of the input list at once to feed the function, 
and its not about config params.


Do any meta-operator syntaxes let you define the base function inline such as if 
it would be a closure, or do they rightly only work for pre-defined symbols and 
you'd have to use a foo() format version of reduce for anything more complicated?


-- Darren Duncan


[perl #78626] Patch: support higher arity in reduce()

2010-10-27 Thread via RT
# New Ticket Created by  Stephen Mosher 
# Please include the string:  [perl #78626]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=78626 



Hi,

Attached is a diff against rakudo/src/core/Any-list.pm which adds support to 
reduce() for higher-arity functions. It ensures arity-list agreement and is 
generally safe. Other than the  test, the functionality was already present... 
it  needed two lines commented out, two uncommented. Since tests passed and 
there were no explanatory comments in the file, jnthn suggested I mail in a 
diff. Here it is.

I was considering including another patch to support functions that reduce to 
more than a single term, but as it turns out this is best handled by using a 
[list] item instead.

Note: if the supplied function _does_ return more than a single term, reduce() 
will not produce a correct result (neither this version nor the original), but 
it will terminate assuming a finite list.

Regards,
Stephen

  --- Any-list.pm	2010-10-18 21:41:03.0 -0400
+++ Any-list.morearity.pm	2010-10-18 21:42:08.0 -0400
@@ -218,15 +218,15 @@
 my $arity = $expression.?count || 2; # second half is a CHEAT
 fail('Cannot reduce() using a unary or nullary function.')
 if $arity  2;
-fail('Can only reduce() using a binary function for now.')
-if $arity  2;
+warn('Arity must agree with list length in reduce().')
+unless (@.elems -1) %% ($arity -1);
 
 my @args = ();
 for @.list {
 @args.push($_);
 if (@args == $arity) {
-my $res = $expression.(@args[0], @args[1]);
-# my $res = $expression.(|@args);
+# my $res = $expression.(@args[0], @args[1]);
+my $res = $expression.(|@args);
 @args = ($res);
 }
 }
@@ -237,8 +237,8 @@
 if @args  $expression.arity {
 warn (@args -1) ~  trailing item(s) in reduce;
 } else {
-return $( $expression.(@args[0], @args[1]) );
-# return $( $expression.(|@args) );
+# return $( $expression.(@args[0], @args[1]) );
+return $( $expression.(|@args) );
 }
 }
 return @args[0];


Re: [perl #78626] Patch: support higher arity in reduce()

2010-10-27 Thread Darren Duncan

Stephen Mosher (via RT) wrote:

Attached is a diff against rakudo/src/core/Any-list.pm which adds support to
reduce() for higher-arity functions. It ensures arity-list agreement and is
generally safe. Other than the  test, the functionality was already
present... it  needed two lines commented out, two uncommented. Since tests
passed and there were no explanatory comments in the file, jnthn suggested I
mail in a diff. Here it is.


What is a common or fundamentally important example of an N-adic function whose 
base operation takes 3 or more operands, such that reduce() would be useful?


I suppose that something like ??!! might conceivably fit the bill since it can 
be arbitrarily chained and is self-similar, but probably not, considering that 
it isn't commutative or associative, but rather just recursive, so I'm not sure 
that reduce() applies here.


-- Darren Duncan


  1   2   3   4   5   6   7   8   9   10   >