log base zero ???

2016-10-19 Thread Francis (Grizzly) Smit
I think I've found a bug some how there is no power that you can raise 0 
to and get 23 or any number, except 0



$ perl6 -e "say log(23, 0);"
-0


shouldn't it be NaN


$ perl6 --version
This is Rakudo version 2016.10-17-g200364a built on MoarVM version 
2016.10-15-g715e39a

implementing Perl 6.c.


--

   .~. In my life God comes first
   /V\ but Linux is pretty high after that :-D
  /( )\Francis (Grizzly) Smit
  ^^-^^http://www.smit.id.au/
-BEGIN GEEK CODE BLOCK-
Version: 3.1
GM/CS/H/P/S/IT/L d- s+:+ a++ C UL$ P+++ L+++$ E--- W+++
N w--- M-- V-- PE- PGP t+ 5-- X-- R- tv b DI(+) D-
G e++ h+ y? r% z---
--END GEEK CODE BLOCK--
http://www.geekcode.com/



[perl #129921] [BUG] compile time error triggers internal warning

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


$ perl6 -e 'my $!a'
Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to 
something meaningful.
   in any throw at src/Perl6/World.nqp line 4037
===SORRY!=== Error while compiling -e
Cannot use ! twigil on 'my' variable
at -e:1
--> my $!a⏏
 expecting any of:
 constraint



[perl #129920] [BUG] Configure.PL does not protect whitespace in --prefix

2016-10-19 Thread brian d foy
# New Ticket Created by  "brian d foy" 
# Please include the string:  [perl #129920]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=129920 >


In the rakudo-star-2016.07 release, the value given to Configure's
--prefix might end up with whitespace (even if the initial value does
not have it). This path is not quoted in nqp/Makefile, so that fails
and the build cannot continue.

I ran into this because I used a path that was a symlink:

% perl Configure.pl --gen-moar --prefix
/Users/brian/Dropbox/perl6s/rakudo-star-2016.07

Various things had the same problem:

% perl Configure.PL --gen-moar --prefix "/Volumes/Big
Scratch/Dropbox/perl6s/rakudo-star-2016.07"
% perl Configure.PL --gen-moar --prefix /Volumes/"Big
Scratch"/Dropbox/perl6s/rakudo-star-2016.07
% perl Configure.PL --gen-moar --prefix /Volumes/Big\\
Scratch/Dropbox/perl6s/rakudo-star-2016.07

Paths interpolated into shell programs or makefiles should be
protected in some fashion.

-- 
brian d foy 
http://www.pair.com/~comdog/


Re: [perl #129909] [BUG] cannot compile to jar files for client use using --target=jvm

2016-10-19 Thread Felipe Valdes
Thank you for the prompt response.

I'll review the JVM script provided, it may run!

Since the feature isn't finished, is there a way to generate a MOAR file I
can provide my users which "just runs" but doesn't include the secret sauce?

or is this an unreasonable expectation?



On Wed, Oct 19, 2016 at 12:00 PM, Pepe Schwarz via RT <
perl6-bugs-follo...@perl.org> wrote:

> On Tue Oct 18 18:07:05 2016, data...@gmail.com wrote:
> > perl6 --target=jvm  --ll-exception --output=guess.jar guess.p6
> >
> >
> > java.lang.NullPointerException
> >
> >   in command_eval (gen/jvm/stage2/NQPHLL.nqp:1217)
> >
> >   in command_eval (src/Perl6/Compiler.nqp:27)
> >
> >   in command_line (gen/jvm/stage2/NQPHLL.nqp:1181)
> >
> >   in MAIN (gen/jvm/main.nqp:47)
> >
> >   in  (gen/jvm/main.nqp:38)
> >
> >   in  (gen/jvm/main.nqp)
> >
> >
> >
> > On Tue, Oct 18, 2016 at 4:43 PM, Elizabeth Mattijsen via RT <
> > perl6-bugs-follo...@perl.org> wrote:
> >
> > > What happens if you add --ll-exception to the command line?
> > >
> > > > On 18 Oct 2016, at 05:42, Felipe Valdes (via RT) <
> > > perl6-bugs-follo...@perl.org> wrote:
> > > >
> > > > # New Ticket Created by  Felipe Valdes
> > > > # Please include the string:  [perl #129909]
> > > > # in the subject line of all future correspondence about this issue.
> > > > # https://rt.perl.org/Ticket/Display.html?id=129909 >
> > > >
> > > >
> > > > I want my clients to be able to run jar files
> > > > generated by the perl6 command:
> > > >
> > > > The program:
> > > >
> > > > my $num = (1..100).pick;
> > > >
> > > > my $guess_count = 0;
> > > >
> > > >
> > > > loop {
> > > >
> > > > my $guess = prompt("guess");
> > > >
> > > > if $guess == $num {
> > > >
> > > > say "Well done";
> > > >
> > > > last;
> > > >
> > > > }
> > > >
> > > > if $guess > $num {
> > > >
> > > > say "Lower";
> > > >
> > > > }
> > > >
> > > > if $guess < $num {
> > > >
> > > > say "Higher";
> > > >
> > > > }
> > > >
> > > > if $guess_count == 7 {
> > > >
> > > > say "you suck!";
> > > >
> > > > last;
> > > >
> > > > }
> > > >
> > > > $guess_count++;
> > > >
> > > > }
> > > >
> > > >
> > > > the compilation command:
> > > >
> > > > perl6 --target=jvm --output=guess.jar guess.p6
> > > >
> > > >
> > > > the result:
> > > >
> > > > ===SORRY!===
> > > >
> > > > java.lang.NullPointerException
> > > >
> > > >
> > > > The version:
> > > >
> > > > This is Rakudo version 2016.10-9-g906719c built on JVM
> > > >
> > > > implementing Perl 6.c.
> > > >
> > > >
> > > > I think the error message is less than awesome.
> > > >
> > > >
> > > > Felipes-MacBook-Pro:backend2 a$ perl6 --stagestats --target=jvm
> > > > --output=guess.jar guess.p6
> > > >
> > > > Stage start  :   0.000
> > > >
> > > > Stage parse  :   3.405
> > > >
> > > > Stage syntaxcheck:   0.001
> > > >
> > > > Stage ast:   0.001
> > > >
> > > > Stage optimize   :   0.140
> > > >
> > > > Stage jast   :   0.395
> > > >
> > > > Stage classfile  :   0.081
> > > >
> > > > Stage jar:   0.000
> > > >
> > > > Stage jvm:   0.006
> > > >
> > > > ===SORRY!===
> > > >
> > > > java.lang.NullPointerException
> > > >
> > > > Felipes-MacBook-Pro:backend2 a$
> > >
> > >
> > >
>
> The feature you're asking for does not exist at the moment.
>
> You can get the precompiled compilation unit of a Perl 6 program as a .jar
> with C<--target=jar>, but that doesn't help you, because it a compilation
> unit that can be understood by a Rakudo executable, not a jar file that can
> be understood by any JVM.
>
> The file at [1] is a shell script that includes the step that will
> eventually be integrated into the perl6 binary to generate a self-contained
> jar file from Perl 6 code, albeit in the simplest way possible. That is,
> bundle the whole interpreter and make that run a predefined compilation
> unit. There is a corresponding Rakudo branch
>
> Note though that the branch hasn't been updated in quite a while and might
> not necessarily merge cleanly against current HEAD.
>
> [1] https://github.com/perl6/nqp/blob/standalone-jar/tools/jvm/
> one-jar-script.sh
>


[perl #129919] [BUG] asinh does not comply with IEEE

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


Perl IEEE[^1]:
1) asinh(-Inf) should return -Inf
2) Any too-large values that don't fit should be an Inf with the correct sign.
3) asinh(-0) gives -0

I fixed[^2] the first issue for num and Num, but not yet sure what the  
correct solution is for Complex.
The rest of the issues are still present:

  m: dd asinh -1e200
  rakudo-moar 74d0e3: OUTPUT«Inf␤» # should be -Inf
  m: dd asinh my num $ = -0e0
  rakudo-moar 74d0e3: OUTPUT«0e0␤» # should be -0e0
  m: dd asinh -0e0
  rakudo-moar 74d0e3: OUTPUT«0e0␤» # should be -0e0
  m: dd asinh -1e200+1i
  rakudo-moar 74d0e3: OUTPUT«␤» # Not sure  
what it should be; WolframAlpha just gives -Inf, with no indication of  
the imaginary part

[1] http://www.csee.umbc.edu/~tsi%E2%80%8Bmo1/CMSC455/IEEE-754-2008.pdf
[2]  
https://github.com/rakudo/rakudo/commit/74d0e36ba27b9736b63b84c0169108a5a9a5d83e



Re: [perl #129907] [BUG] interaction of class FALLBACK methods and safe method calls (.?)

2016-10-19 Thread David Warring
I've worked out how to do it, by adding a custom dispatch:<.?> method:

use Test;

class C {
method foo { 42 }
method can($meth-name) {
my $meths = callsame;
if !$meths && $meth-name eq 'bar' {
$meths = [method { 69 }, ];
self.^add_method($meth-name, $meths[0]);
}
$meths;
}
method dispatch:<.?>(\name, |c) is raw {
self.can(name)
?? self."{name}"(|c)
!! Nil
}
method FALLBACK(\name, |c) {
if self.can(name) {
self."{name}"(|c);
}
else {
die X::Method::NotFound.new( :method(name),
:typename(self.^name) );
}
}
}

for C {
my $obj = .new;
is $obj.foo, 42, 'static method - direct call';
is $obj.?foo, 42, 'static method - safe call';
is $obj.bar, 69, 'dynamic method - direct call';
is $obj.?bar, 69, 'dynamic method - safe call';
dies-ok {$obj.unknown}, 'direct call - unknown method dies';
lives-ok {$obj.?unknown}, 'safe call - unknown method lives';
}

Based on some code I found in the core Rakudo Mu class.
Slightly awkward, but at least working.

On Tue, Oct 18, 2016 at 1:35 PM, David Warring  wrote:

> # New Ticket Created by  David Warring
> # Please include the string:  [perl #129907]
> # in the subject line of all future correspondence about this issue.
> # https://rt.perl.org/Ticket/Display.html?id=129907 >
>
>
> I'm adding a FALLBACK method to create method dynamically, the it receives
> both '.' and '.?' invocations, and I can't distinguish between them.
>
> This then breaks $obj.unknown vs $obj.?unknown handling in class objects.
>
> Consider:
>
> use Test;
>
> class C {
> method foo { 42 }
> method FALLBACK($meth-name, |c) {
> warn "can $meth-name";
> if $meth-name eq 'bar' {
> self.^add_method($meth-name, method { 69 });
> self."$meth-name"(|c);
> }
> else {
> warn "dunno if this is a safe method call or not";
> Nil;
> }
> }
> }
>
> for C {
> my $obj = .new;
> is $obj.foo, 42, 'static method - direct call';
> is $obj.?foo, 42, 'static method - safe call';
> is $obj.bar, 69, 'dynamic method - direct call';
> is $obj.?bar, 69, 'dynamic method - safe call';
> todo "can't get both of these to pass!";
> dies-ok {$obj.unknown}, 'direct call - unknown method dies';
> lives-ok {$obj.?unknown}, 'safe call - unknown method lives';
> }
>
> I'm receiving both the safe and unsafe 'unknown' invocations, and can't
> distinguish them.
>
> I also tried overriding the classes 'can' method:
>
> class C {
> method foo { 42 }
> method can($meth-name) {
> my $meths = callsame;
> if !$meths && $meth-name eq 'bar' {
> $meths = [method { 69 }, ];
> self.^add_method($meth-name, $meths[0]);
> }
> $meths;
> }
> method FALLBACK($meth-name, |c) {
> if self.can($meth-name) {
> self."$meth-name"(|c);
> }
> else {
> warn "dunno if this is a safe method call or not";
> Nil;
> }
> }
> }
>
> But the FALLBACK is still needed, and still has the same problem.
>
> Any ideas?
>


[perl #129909] [BUG] cannot compile to jar files for client use using --target=jvm

2016-10-19 Thread Pepe Schwarz via RT
On Tue Oct 18 18:07:05 2016, data...@gmail.com wrote:
> perl6 --target=jvm  --ll-exception --output=guess.jar guess.p6
> 
> 
> java.lang.NullPointerException
> 
>   in command_eval (gen/jvm/stage2/NQPHLL.nqp:1217)
> 
>   in command_eval (src/Perl6/Compiler.nqp:27)
> 
>   in command_line (gen/jvm/stage2/NQPHLL.nqp:1181)
> 
>   in MAIN (gen/jvm/main.nqp:47)
> 
>   in  (gen/jvm/main.nqp:38)
> 
>   in  (gen/jvm/main.nqp)
> 
> 
> 
> On Tue, Oct 18, 2016 at 4:43 PM, Elizabeth Mattijsen via RT <
> perl6-bugs-follo...@perl.org> wrote:
> 
> > What happens if you add --ll-exception to the command line?
> >
> > > On 18 Oct 2016, at 05:42, Felipe Valdes (via RT) <
> > perl6-bugs-follo...@perl.org> wrote:
> > >
> > > # New Ticket Created by  Felipe Valdes
> > > # Please include the string:  [perl #129909]
> > > # in the subject line of all future correspondence about this issue.
> > > # https://rt.perl.org/Ticket/Display.html?id=129909 >
> > >
> > >
> > > I want my clients to be able to run jar files
> > > generated by the perl6 command:
> > >
> > > The program:
> > >
> > > my $num = (1..100).pick;
> > >
> > > my $guess_count = 0;
> > >
> > >
> > > loop {
> > >
> > > my $guess = prompt("guess");
> > >
> > > if $guess == $num {
> > >
> > > say "Well done";
> > >
> > > last;
> > >
> > > }
> > >
> > > if $guess > $num {
> > >
> > > say "Lower";
> > >
> > > }
> > >
> > > if $guess < $num {
> > >
> > > say "Higher";
> > >
> > > }
> > >
> > > if $guess_count == 7 {
> > >
> > > say "you suck!";
> > >
> > > last;
> > >
> > > }
> > >
> > > $guess_count++;
> > >
> > > }
> > >
> > >
> > > the compilation command:
> > >
> > > perl6 --target=jvm --output=guess.jar guess.p6
> > >
> > >
> > > the result:
> > >
> > > ===SORRY!===
> > >
> > > java.lang.NullPointerException
> > >
> > >
> > > The version:
> > >
> > > This is Rakudo version 2016.10-9-g906719c built on JVM
> > >
> > > implementing Perl 6.c.
> > >
> > >
> > > I think the error message is less than awesome.
> > >
> > >
> > > Felipes-MacBook-Pro:backend2 a$ perl6 --stagestats --target=jvm
> > > --output=guess.jar guess.p6
> > >
> > > Stage start  :   0.000
> > >
> > > Stage parse  :   3.405
> > >
> > > Stage syntaxcheck:   0.001
> > >
> > > Stage ast:   0.001
> > >
> > > Stage optimize   :   0.140
> > >
> > > Stage jast   :   0.395
> > >
> > > Stage classfile  :   0.081
> > >
> > > Stage jar:   0.000
> > >
> > > Stage jvm:   0.006
> > >
> > > ===SORRY!===
> > >
> > > java.lang.NullPointerException
> > >
> > > Felipes-MacBook-Pro:backend2 a$
> >
> >
> >

The feature you're asking for does not exist at the moment.

You can get the precompiled compilation unit of a Perl 6 program as a .jar with 
C<--target=jar>, but that doesn't help you, because it a compilation unit that 
can be understood by a Rakudo executable, not a jar file that can be understood 
by any JVM.

The file at [1] is a shell script that includes the step that will eventually 
be integrated into the perl6 binary to generate a self-contained jar file from 
Perl 6 code, albeit in the simplest way possible. That is, bundle the whole 
interpreter and make that run a predefined compilation unit. There is a 
corresponding Rakudo branch

Note though that the branch hasn't been updated in quite a while and might not 
necessarily merge cleanly against current HEAD.

[1] https://github.com/perl6/nqp/blob/standalone-jar/tools/jvm/one-jar-script.sh


[perl #128833] [CONC][SEGV] async and grammar related data issue

2016-10-19 Thread jn...@jnthn.net via RT
On Wed Aug 03 17:07:49 2016, jdv79 wrote:
> [jdv@wieldy ~]$ perl6 test_grammar_n_threads.p6
> Use of uninitialized value $!made of type Any in string context
>  Any of .^name, .perl, .gist, or .say can stringify undefined things,
> if
> needed.Use of uninitialized value $!made of type Any in string context
>  Any of .^name, .perl, .gist, or .say can stringify undefined things,
> if
>  needed.  in block  at
>  

This one I've managed to hunt down and fix. It's covered by a new test in 
S17-promise/start.t.

> [jdv@wieldy ~]$ perl6 test_grammar_n_threads.p6
>  *** Error in `/home/jdv/rakudo/install/bin/moar': double free or
> corruption (fasttop): 0x0533c8a0 ***
> === Backtrace: =
> /lib64/libc.so.6(+0x77d9e)[0x7f6585d5fd9e]
> /lib64/libc.so.6(cfree+0x5b5)[0x7f6585d6b9f5]
> //home/jdv/rakudo/install/lib/libmoar.so(MVM_interp_run+0x13b83)[0x7f658620d813]
> //home/jdv/rakudo/install/lib/libmoar.so(+0x1774be)[0x7f658621c4be]
> //home/jdv/rakudo/install/lib/libmoar.so(+0x23cf17)[0x7f65862e1f17]
> /lib64/libpthread.so.0(+0x752a)[0x7f65857cb52a]
> /lib64/libc.so.6(clone+0x6d)[0x7f6585de822d]

This one I've only managed to tickle once out of a hundred runs, and not with 
exactly that backtrace either. Will have to look into it a bit further.

/jnthn


[perl #129915] [LTA] ∞ as literal Inf not recognized in signatures

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


∞ as literal Inf not recognized in signatures, unless it's a signature  
literal:

 m: sub (∞) {}
 rakudo-moar 200364: OUTPUT«===SORRY!=== Error while  
compiling ␤Missing block␤at :1␤--> sub (⏏∞) {}␤»
 m: say :(∞)
 rakudo-moar 200364: OUTPUT«Inf␤»

13:51   iBakeCake   m: multi sub infix:<≅> (∞, ∞) { Bool::True };
13:51   camelia rakudo-moar 200364: OUTPUT«===SORRY!=== Error while  
compiling ␤Missing block␤at :1␤--> multi sub infix:<≅>  
(⏏∞, ∞) { Bool::True };␤»
13:51   iBakeCake   m: multi sub infix:<≅> (Inf, Inf) { Bool::True };
13:51   camelia rakudo-moar 200364: ( no output )



[perl #129882] [CONC] [IO] Proc with `.in.close` and `.out.slurp-rest` in different threads, hangs

2016-10-19 Thread jn...@jnthn.net via RT
On Fri Oct 14 16:40:27 2016, sml...@gmail.com wrote:
> The following code attempts to pipe a large Blob (larger than a pipe's
> buffer size) through an external command.
> However, it hangs on the `.in.close` line and never finishes:
> 
> my $proc = run «cat -», :in, :out, :bin;
> my $input = ("a" x 100).encode;
> my $promise = start {
> $proc.in.write: $input;
> $proc.in.close;
> }
> say $proc.out.slurp-rest(:close, :bin).bytes;
> await $promise;
> 
For now, if using threads, stick with Proc::Async (in the future, we'll 
probably re-implement Proc/run etc. in terms of Proc::Async).

/jnthn