Re: A new problem.

2015-08-14 Thread Lyle

Hi,
  It sounds like the file is non UTF-8, in a French locale (probably 
ISO-885901, Windows-1252, or the mac equivalent) but you are trying to 
load it as UTF-8 (which may well be the default).


I suspect if you save the text file as UTF-8 and try again it'll work.


Lyle


On 12/08/2015 16:32, Christian Aperghis-Tramoni wrote:
Now I hane rakudo on MoarVM working, I get an error I didn't have 
formerly on parrotVM.


Ech time i read a file containing french diacritic characters (éèàç 
...) it returns  the error :


Malformed UTF-8

if the file contains only standards ascii charecters, i do not have 
any problem.


Can you tell me how to solve this.

Thanks.





Coroutines

2015-08-14 Thread Matija Papec

Hi,

I'm looking for single threaded coroutines in perl6. Will hyper/race make them 
possible?
Will 2015 production Rakudo include async IO?

Right now I'm considering golang for scalable websocket service, but also 
wonder if perl6 would
(and how) make such thing possible.


ps. I would very much appreciate existing articles on this topic. TIA


[perl #125808] [BUG] GLOBAL is NQPMu in sub EXPORT which breaks indirect calls

2015-08-14 Thread via RT
# New Ticket Created by  Lloyd Fournier 
# Please include the string:  [perl #125808]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125808 >


# lib/Foo.pm
use Test;
sub EXPORT {
  say GLOBAL.^name; #-> NQPMu
  say Test; #-> (Test)
  say ::('Test');  #-> Cannot find method 'EXISTS-KEY': no method cache
and no .^find_method
}
#This is perl6 version 2015.07.1-111-ge0f7259 built on MoarVM version
2015.07-8-gb8fdeae
===

Test is just there as an example symbol for a valid indirect call. This was
working not too long ago afaik.

My amateur opinion is because

https://github.com/rakudo/rakudo/blob/nom/src/core/operators.pm#L530

INDIRECT_NAME_LOOKUP relies on GLOBAL being defined and for some reason it
is NQPMu.


Proposed new string methods: trim-rw, trim-leading-rw, trim-trailing-rw

2015-08-14 Thread Tom Browder
In an earlier thread of mine on this list seeking help, Liz mentioned
one string method that has now been dcoumented, 'substr-rw', which
allows in-place modification of a string variable.

In my journey with Perl 6 I have enjoyed the string 'trim' method so I
can do this:

  my $s = '   blah ';
  $s = $s.trim;
  say $s; # 'blah'

Using 'substr-rw' as precedent, I am proposing a similar set of
methods for 'trim' so that I can do this:

  my $s = '  blah ';
  $s.trim-rw;
  say $s; # 'blah';

(and similarly for 'trim-leading-rw' and 'trim-trailing-rw').

If there is no objection, I would like to add a feature request but
where to do it?  The immediate place I thought of is the Rakudo git
site but isn't this more of a language feature?

Best regards,

-Tom


Re: Proposed new string methods: trim-rw, trim-leading-rw, trim-trailing-rw

2015-08-14 Thread Philip Hazelden
Correct me if I'm wrong, can't you do

$s .= trim

?

On 12:45pm, Fri, 14 Aug 2015 Tom Browder  wrote:

> In an earlier thread of mine on this list seeking help, Liz mentioned
> one string method that has now been dcoumented, 'substr-rw', which
> allows in-place modification of a string variable.
>
> In my journey with Perl 6 I have enjoyed the string 'trim' method so I
> can do this:
>
>   my $s = '   blah ';
>   $s = $s.trim;
>   say $s; # 'blah'
>
> Using 'substr-rw' as precedent, I am proposing a similar set of
> methods for 'trim' so that I can do this:
>
>   my $s = '  blah ';
>   $s.trim-rw;
>   say $s; # 'blah';
>
> (and similarly for 'trim-leading-rw' and 'trim-trailing-rw').
>
> If there is no objection, I would like to add a feature request but
> where to do it?  The immediate place I thought of is the Rakudo git
> site but isn't this more of a language feature?
>
> Best regards,
>
> -Tom
>


Re: Proposed new string methods: trim-rw, trim-leading-rw, trim-trailing-rw

2015-08-14 Thread Tom Browder
On Fri, Aug 14, 2015 at 6:48 AM, Philip Hazelden
 wrote:
> Correct me if I'm wrong, can't you do
>
> $s .= trim

Um, I saw that usage in an earlier thread but didn't try it because it
didn't "look right" given my experience with the ".=" operator as I'm
used to it. (Note I have now seen that behavior clearly documented at
.)

But I've tried it and it works (but the syntax still bothers me for
now).  Note that the same behavior applies to the 'substr' string
method so that begs the question of why is the 'substr-rw' method
justified and 'trim-rw' not?  It seems at first glance that the
'substr-rw' method should be removed.

Thanks, Philip.

Best regards,

-Tom


Re: Proposed new string methods: trim-rw, trim-leading-rw, trim-trailing-rw

2015-08-14 Thread Brandon Allbery
On Fri, Aug 14, 2015 at 8:07 AM, Tom Browder  wrote:

> But I've tried it and it works (but the syntax still bothers me for
> now).  Note that the same behavior applies to the 'substr' string
> method so that begs the question of why is the 'substr-rw' method
> justified and 'trim-rw' not?  It seems at first glance that the
> 'substr-rw' method should be removed.
>

IIRC substr-rw is a performance hack because substr was being slowed in all
cases in order to accommodate the rw use case. trim doesn't have the same
issue.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Proposed new string methods: trim-rw, trim-leading-rw, trim-trailing-rw

2015-08-14 Thread Tom Browder
On Aug 14, 2015 8:46 AM, "Brandon Allbery"  wrote:
> On Fri, Aug 14, 2015 at 8:07 AM, Tom Browder  wrote:
...
>> now).  Note that the same behavior applies to the 'substr' string
>> method so that begs the question of why is the 'substr-rw' method
>> justified and 'trim-rw' not?  It seems at first glance that the
>> 'substr-rw' method should be removed.
...
> IIRC substr-rw is a performance hack because substr was being slowed
> in all cases in order to accommodate the rw use case. trim doesn't
> have the same issue.

Thanks for the enlightenment, Brandon.

-Tom


Re: Coroutines

2015-08-14 Thread Timo Paulssen
On 08/14/2015 12:04 PM, Matija Papec wrote:
> Hi,
>
> I'm looking for single threaded coroutines in perl6. Will hyper/race make 
> them possible?
> Will 2015 production Rakudo include async IO?
>
> Right now I'm considering golang for scalable websocket service, but also 
> wonder if perl6 would
> (and how) make such thing possible.
>
>
> ps. I would very much appreciate existing articles on this topic. TIA
Hi Matija,

hyper and race are explicitly for spreading computation across threads.
Perhaps you confused that with gather/take, which is a pretty good first
approximation for coroutines.

Rakudo already includes async IO on both the jvm and moarvm backends,
but there's more functions and classes we're still looking to build in
the future.

Maybe these slides'll be interesting to you for async stuff, but it
doesn't have much async I/O in them:
http://jnthn.net/papers/2014-yapceu-async.pdf

if you have any more questions, feel free to also visit us on the IRC:
#perl6 on freenode

MfG
  - Timo


[perl #125745] Custom infix:<~~> multi not used by rakudo

2015-08-14 Thread Christian Bartolomaeus via RT
I added a test with commit d2d4f7a9.

In comments to PR 487 it was suggested to make the error message even better by 
mentioning .ACCEPTS 
(https://github.com/rakudo/rakudo/pull/487#issuecomment-127776087).

Should we leave the ticket open until someone does that or is the ticket 
closeable?


[perl #125811] 2 ** 99999999999999999999999999999999999 = 0

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125811]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125811 >


 m: say 2 ** 999
 rakudo-moar ab73b0: OUTPUT«0␤»

That's it.

It also depends on the platform. On 32-bit the result of this is zero (but
camelia times out):
 m: say 2 ** 268435456
 rakudo-moar ab73b0: OUTPUT«(timeout)»


[perl #125812] LTA error message when doing with() { } with no whitespace before ()

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125812]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125812 >


Code:
with(1) { }

Result:
===SORRY!=== Error while compiling ./test.pl
Unexpected block in infix position (missing statement control word before
the expression?)
at ./test.pl:2
--> with(1)⏏ { }
expecting any of:
infix
infix stopper

It looks like “with” and “without” are missing some checks, unlike “if”,
“unless”. Here is what happens if you use if:
===SORRY!===
Word 'if' interpreted as 'if()' function call; please use whitespace
instead of parens
at ./test.pl:2
--> if⏏(1) { }
Unexpected block in infix position (two terms in a row)
at ./test.pl:2
--> if(1)⏏ { }

In other words, “with” and “without” should produce same error message
about whitespace.

IRC log: http://irclog.perlgeek.de/perl6/2015-08-15#i_11061258


[perl #125813] Malformed UTF-8 (string out of bounds) with “say ('a' x 10000).IO.open”

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125813]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125813 >


Code:
say ('a' x 970).IO.open;

Result:
Failed to open file
/home/alex/perl6test/a
 a:
name too l
  in block  at ./test.pl:2

Notice how it says “name too l”. It should be “name too long” but it does
not fit. And if we add more digits:
say ('a' x 1).IO.open;

Result:
Malformed UTF-8 at line 1 col 1029
  in block  at ./test.pl:2


[perl #125814] .chop(9999999999999999999999999999999999999999999999999) does not chop

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125814]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125814 >


Code:
say 'xx'.chop().perl;
say 'xx'.chop(9).perl;


Result:
""
"xx"


[perl #125815] :nth(-666) is intended to die, but it does not

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125815]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125815 >


You can put any negative number (even -Inf) and it will not die:

 m: say 'foo foo foo'.subst(/foo/, "bar", :nth(-Inf));
 rakudo-moar ab73b0: OUTPUT«foo foo foo␤»

However, from https://github.com/rakudo/rakudo/blob/nom/src/core/Str.pm#L606
:
fail "Attempt to retrieve negative match :nth($n)" if $n < 1;

So it seems like it does not work?

Also, it should talk about allowing only positive values because the
conditional is checking for < 1.


[perl #125816] "x".indent(9999999999999999999999999999999999999999999999999)

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125816]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125816 >


First part is OK, but once we start increasing the number it falls apart.

say "x".indent(9);
repeat count > 1073741824 arbitrarily unsupported...
  in block  at ./test.pl:2

say "x".indent(9);
repeat count (-537617205517352961) cannot be negative
  in block  at ./test.pl:3

say
"x".indent(9);
repeat count (-1) cannot be negative
  in block  at ./test.pl:4


[perl #125817] chr(999999999999999999999999999) – chr codepoint cannot be negative (LTA)

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125817]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125817 >


Code:
say chr 999;

Result:
chr codepoint cannot be negative
  in block  at ./test.pl:2


Well, it is not negative.


[perl #125818] LTA error message: Inf.base(16)

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125818]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125818 >


Code:
say Inf.base(16)

Result:
Type check failed in assignment to '$int_part'; expected 'Int' but got
'Failure'
  in block  at ./test.pl:2

Same thing with NaN.

IRC log: http://irclog.perlgeek.de/perl6/2015-08-15#i_11061555


[perl #125819] 255.base(16, -666) and friends

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125819]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125819 >


Code:
say 255.base(16, -100);

Result:
FF.

Docs say (http://doc.perl6.org/routine/base#role_Real):
“The optional $digits argument asks for that many digits of fraction (which
may not be negative).”
So there is something wrong.


And also our classic stuff:
Code:
say 255.base(16, 9);

Result:
repeat count (-537617205517352961) cannot be negative
  in block  at ./test.pl:2

Code:
say 255.base(16,
9);

Result:
repeat count (-1) cannot be negative
  in block  at ./test.pl:2


[perl #125820] .roll(-9999999999999999999999999999999999999999999999999)

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125820]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125820 >


Code:
say .roll(-9).perl;

Result:
it hangs

Code:
say .roll(-9).perl;

Result:
("b",)


On the other hand:
say .roll(9).perl;

Result:
()


[perl #125821] LTA error message when doing .rotate(Inf)

2015-08-14 Thread via RT
# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #125821]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=125821 >


Code:
say .rotate(Inf);

Result:
Earlier failures:
 No zero-arg meaning for infix:<%>
  in block  at ./test.pl:2

Final error:
 Cannot call Real(Failure: ); none of these signatures match:
(Mu:U \v: *%_)
  in block  at ./test.pl:2


Same problem with NaN and -Inf.

Somewhat similar bug report:
https://rt.perl.org/Public/Bug/Display.html?id=125818