[perl #127339] problem using Duration

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


l.s.

In REPL;

 > my Duration $d .= new(10);
10
 > $d += 1000
1010
 > $d -= 900
110
 > $d *= 2
Type check failed in assignment to $d; expected Duration but got Num
   in block  at  line 1
 > $d /= 2
Type check failed in assignment to $d; expected Duration but got Num
   in block  at  line 1
 > $d * 2
220
 > $d .= new($d * 2)
220


Conclusion is that += and -= works but *= and /= do not while $d * 2 
gives a proper answer without problem. Only last method works.

Greetings
Marcel Timmerman


This is Rakudo version 2015.12-201-g2a8ca94 built on MoarVM version 
2015.12-29-g8079ca5
implementing Perl 6.c.



Re: [perl #127330] [SLOW] 10_000 lines with 「say ‘a’;」 take 16 seconds to run

2016-01-21 Thread Elizabeth Mattijsen

> On 21 Jan 2016, at 00:42, Alex Jakimenko (via RT) 
>  wrote:
> 
> # New Ticket Created by  Alex Jakimenko 
> # Please include the string:  [perl #127330]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=127330 >
> 
> 
> Create a file with 10_000 lines:
> 
> for x in {1..1}; do echo 'say ‘a’;' >> print.p6; done
> 
> And then time it:
> 
> time perl6 print.p6
> 
> It will take around 16 seconds to run.
> 
> You can also use 「print」 instead of 「say」, it does not matter.
> 
> The time grows linearly. I haven't done any serious benchmarks but please
> look at the attached graph, the data just speaks for itself.
> 
> Very important note (by Zoffix++):
> “It's all in compilation too.
> 17 seconds before it told me I got a syntax error.
> It takes 17s to run 10,000 prints on my box, but if I move them into a
> module and a sub and precompile the module, then I get 1.2s run. This is
> all compared to 0.2s run with Perl 5 on the same box”
> 
> Perhaps sub lookups are that slow?
> 
> Originally reported by zhmylove++.
> 

The delay is because of the parsing of the code:  using the —stagestats 
parameter, I get something like this on my machine:

$ time perl6 --stagestats print.p6 
Stage start  :   0.000
Stage parse  :   5.781
Stage syntaxcheck:   0.000
Stage ast:   0.000
Stage optimize   :   0.527
Stage mast   :   1.088
Stage mbc:   0.116
Stage moar   :   0.000
…
real0m7.694s
user0m7.546s
sys 0m0.194s

As you can see, most of the time is spent parsing the file, and then optimizing 
and then generating the bytecode.


This won’t get any faster until we spend time on optimizing grammars in NQP 
and/or MoarVM performance in general.



Liz

Re: is there a Perl 5 converter?

2016-01-21 Thread Steve Mynott
On 21 January 2016 at 01:40, Darren Duncan  wrote:
> On 2016-01-20 5:02 PM, ToddAndMargo wrote:
>>
>> or is it all by hand?
>
>
> If you mean a source code translator, I don't know of one right now but I
> wouldn't be surprised if one exists, that at least handles a common subset
> of Perl 5 code.  I expect having one will be a priority if it isn't around
> now.

There are at least two source code translators in progress:

http://search.cpan.org/dist/Perl-ToPerl6/

https://github.com/Util/Blue_Tiger/

They probably help but I'd be surprised if they work particularly well
yet in producing code which runs straight off.

-- 
4096R/EA75174B Steve Mynott 


Re: is there a Perl 5 converter?

2016-01-21 Thread Bruce Gray

On Jan 21, 2016, at 2:36 AM, Steve Mynott  wrote:

> On 21 January 2016 at 01:40, Darren Duncan  wrote:
>> On 2016-01-20 5:02 PM, ToddAndMargo wrote:
>>> 
>>> or is it all by hand?
>> 
>> 
>> If you mean a source code translator, I don't know of one right now but I
>> wouldn't be surprised if one exists, that at least handles a common subset
>> of Perl 5 code.  I expect having one will be a priority if it isn't around
>> now.
> 
> There are at least two source code translators in progress:
> 
> http://search.cpan.org/dist/Perl-ToPerl6/
> 
> https://github.com/Util/Blue_Tiger/
> 
> They probably help but I'd be surprised if they work particularly well
> yet in producing code which runs straight off.

I am the author of one of the translators (Blue Tiger),
and I welcome feedback on which parts are missing that
would (be|have been) useful to you; it will help me prioritize development.

For automated translation, see 
http://docs.perl6.org/language/5to6-nutshell#Automated_Translation
   Blue Tiger (p526) and Perl-ToPerl6 (perlmogrify) are the most useable.
   Perlito's website is down.

( For manual translation, read all of the 5to6-* docs at the top of 
http://docs.perl6.org/language.html , or email me ).

Below, I have a terminal log of installation and execution of both translators.

$ cat >example.pl < $c {
   "$c$c$c\n".print();
}

$ git clone git://github.com/Util/Blue_Tiger.git
$ cd Blue_Tiger
$ bin/p526 ../example.pl


my @aaa = < a b c d e f g >;

for @aaa <-> $c {
   print "$c$c$c\n";
}


-- 
Hope this helps,
Bruce Gray (Util on IRC)




Re: [perl #127308] Configure.pl with moar fails to find C compiler on older Darwin

2016-01-21 Thread Steve Mynott via RT
My guess is that the PPC version of OS X probably still has the real
GCC as its compiler rather than clang as on more modern systems.

You could try looking for the config line which contains the definiton
of clang for OS X/darwin and changing it to gcc or if you are using
rakudobrew maybe something like

rakudobrew build moar --configure-opts=--moar-option=--cc=gcc

might work?

On 18 January 2016 at 17:26, James E Keenan
 wrote:
> # New Ticket Created by  James E Keenan
> # Please include the string:  [perl #127308]
> # in the subject line of all future correspondence about this issue.
> # https://rt.perl.org/Ticket/Display.html?id=127308 >
>
>
> Today I tried for the first time to build Perl 6 from source -- specifically 
> Rakudo Star 2015.11 -- on my older Darwin/PPC.  (I first tried to do so with 
> 'rakudobrew', but that utility apparently has dependencies on more recent 
> versions of 'git' than I can install on this machine.)  Configuration failed 
> -- but at a point so early in the process that I was surprised.
>
> Here is what I called and got:
>
> ##
> [rakudo] 545 $ cd rakudo-star-2015.11
> [rakudo-star-2015.11] 546 $ perl Configure.pl --backend=moar --gen-moar
> ATTENTION: no --prefix supplied, building and installing to 
> /Users/jimk/rakudo/rakudo-star-2015.11/install
>
> Configuring and building MoarVM ...
> perl Configure.pl --optimize 
> --prefix=/Users/jimk/rakudo/rakudo-star-2015.11/install --make-install
> Welcome to MoarVM!
>
> Configuring native build environment ... OK
> probing whether your compiler thinks that it is gcc  Can't compile simple 
> gcc probe, so something is badly wrong at build/probe.pm line 92.
> Command failed (status 32512): perl Configure.pl --optimize 
> --prefix=/Users/jimk/rakudo/rakudo-star-2015.11/install --make-install
> ##
>
> Well, my compiler is definitely gcc.  It's still capable of building 
> perl-5.22.1 from source.  I examined ./MoarVM/build/probe.pm and just above 
> that point I saw C code to detect a C compiler.  I extracted it, compiled it 
> and ran it.
>
> ##
>
> $ cat try.c
> #include 
>
> int main(int argc, char **argv) {
> #ifdef __GNUC__
>  return EXIT_SUCCESS;
> #else
>  return EXIT_FAILURE;
> #endif
> }
>
>
> $ gcc -o try try.c
>
> $ perl -e '$rv = system(qq{./try}); print "<$rv>\n";'
> <0>
> ##
>
> So the C probe works by itself, but the program in which it is embedded 
> fails.  Any ideas?
>
> Thank you very much.
> Jim Keenan
> --
> James E Keenan (jkee...@cpan.org)
> Summary of my perl5 (revision 5 version 22 subversion 1) configuration:
>
>   Platform:
> osname=darwin, osvers=8.11.0, archname=darwin-2level
> uname='darwin macintosh-9.local 8.11.0 darwin kernel version 8.11.0: wed 
> oct 10 18:26:00 pdt 2007; root:xnu-792.24.17~1release_ppc power macintosh 
> powerpc '
> config_args='-des'
> hint=recommended, useposix=true, d_sigaction=define
> useithreads=undef, usemultiplicity=undef
> use64bitint=undef, use64bitall=undef, uselongdouble=undef
> usemymalloc=n, bincompat5005=undef
>   Compiler:
> cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe 
> -I/usr/local/include -I/opt/local/include -D_FORTIFY_SOURCE=2',
> optimize='-O3',
> cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe 
> -I/usr/local/include -I/opt/local/include'
> ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5250)', 
> gccosandvers=''
> intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321, 
> doublekind=4
> d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, 
> longdblkind=6
> ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
> lseeksize=8
> alignbytes=8, prototype=define
>   Linker and Libraries:
> ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib 
> -L/opt/local/lib'
> libpth=/usr/local/lib /usr/lib /opt/local/lib
> libs=-lpthread -ldbm -ldl -lm -lc
> perllibs=-lpthread -ldl -lm -lc
> libc=, so=dylib, useshrplib=false, libperl=libperl.a
> gnulibc_version=''
>   Dynamic Linking:
> dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
> cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup 
> -L/usr/local/lib -L/opt/local/lib'
>
>
> Characteristics of this binary (from libperl):
>   Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
> PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
> PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
> USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
> USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
> USE_PERLIO USE_PERL_ATOF
>   Built under darwin
>   Compiled at Dec 13 2015 21:51:07
>   %ENV:
> PERLBREW_BASHRC_VERSION="0.59"
> PERLBREW_HOME="/Users/jimk/.perlbrew"
> 

Re: [perl #127308] Configure.pl with moar fails to find C compiler on older Darwin

2016-01-21 Thread Brandon Allbery via RT
On Wed, Jan 20, 2016 at 11:37 AM, Steve Mynott 
wrote:

> My guess is that the PPC version of OS X probably still has the real
> GCC as its compiler rather than clang as on more modern systems.
>

This will also be true of Intel-based Macs with Xcode 3.x or earlier
(roughly OS X 10.6 and earlier).

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



Re: is there a Perl 5 converter?

2016-01-21 Thread Tom Browder
On Thursday, January 21, 2016, Bruce Gray  wrote:
> On Jan 21, 2016, at 2:36 AM, Steve Mynott  wrote:
> > On 21 January 2016 at 01:40, Darren Duncan  wrote:
> >> On 2016-01-20 5:02 PM, ToddAndMargo wrote:
> > There are at least two source code translators in progress:
> > http://search.cpan.org/dist/Perl-ToPerl6/
> > https://github.com/Util/Blue_Tiger/
...
> I am the author of one of the translators (Blue Tiger),
> and I welcome feedback on which parts are missing that
> would (be|have been) useful to you; it will help me prioritize development.
>
> For automated translation, see 
> http://docs.perl6.org/language/5to6-nutshell#Automated_Translation
>Blue Tiger (p526) and Perl-ToPerl6 (perlmogrify) are the most useable.
>Perlito's website is down.
>
> ( For manual translation, read all of the 5to6-* docs at the top of 
> http://docs.perl6.org/language.html , or email me ).
>
> Below, I have a terminal log of installation and execution of both 
> translators.
..

Perl 5 source
==
> my @aaa = qw( a b c d e f g );
> for my $c (@aaa) {

Perl::ToPerl6
=
> my @aaa = qw ( a b c d e f g );
> for (@aaa) -> $c {

Blue_Tiger

> my @aaa = < a b c d e f g >;
> for @aaa <-> $c {

For the example Perl 5 input I like the Blue_Tiger translation, except
I haven't so far found an description of the '<->' operator.  Why
would Blue_Tiger prefer it to the '->' operator which I've seen in all
the examples I can remember seeing?

Thanks.

Cheers!

-Tom


[perl #127340] no line number on error

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


L.s.

Got this error;

Internal error: zeroed target thread ID in work pass

I really don't know where this happens, except it has something to with 
threads using Promise

Greetings
Marcel Timmerman


Re: is there a Perl 5 converter?

2016-01-21 Thread Aaron Baugher
Tom Browder  writes:

> Perl 5 source
> ==
>> my @aaa = qw( a b c d e f g );
>> for my $c (@aaa) {
>
> Perl::ToPerl6
> =
>> my @aaa = qw ( a b c d e f g );
>> for (@aaa) -> $c {
>
> Blue_Tiger
> 
>> my @aaa = < a b c d e f g >;
>> for @aaa <-> $c {
>
> For the example Perl 5 input I like the Blue_Tiger translation, except
> I haven't so far found an description of the '<->' operator.  Why
> would Blue_Tiger prefer it to the '->' operator which I've seen in all
> the examples I can remember seeing?

In Perl 5, the loop variable ($c) is an alias into the array, and changing its 
value changes the the value in the array.  In Perl 6, the array being worked on 
is read-only by default, so in the Perl::ToPerl6 example, trying to change the 
value of $c inside the loop would throw an error.  Using the <-> operator (also 
pointing back from the loop variable to the array) tells it to use the Perl 5 
behavior, where the array can be changed by changing the loop variable.


-- 
Aaron -- aaron.baugher.biz


Re: [perl #127340] no line number on error

2016-01-21 Thread mt1957

On 01/21/2016 06:35 PM, mt1957 (via RT) wrote:

# New Ticket Created by  mt1957
# Please include the string:  [perl #127340]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=127340 >


L.s.

Got this error;

Internal error: zeroed target thread ID in work pass

I really don't know where this happens, except it has something to with
threads using Promise

Greetings
Marcel Timmerman
Following is done. I guessed that the line just enetered was perhaps a 
problem so commented it out.
Run the program and the error was gone. Then, removed the '#' and run 
again. still gone! weird!


Race conditions perhaps?




Re: is there a Perl 5 converter?

2016-01-21 Thread Tom Browder
On Thu, Jan 21, 2016 at 12:00 PM, Aaron Baugher  wrote:
> Tom Browder  writes:
...
>> For the example Perl 5 input I like the Blue_Tiger translation, except
>> I haven't so far found an description of the '<->' operator.  Why
>> would Blue_Tiger prefer it to the '->' operator which I've seen in all
>> the examples I can remember seeing?
>
> In Perl 5, the loop variable ($c) is an alias into the array, and changing 
> its value changes the the value in the array.  In Perl 6, the array being 
> worked on is read-only by default, so in the Perl::ToPerl6 example, trying to 
> change the value of $c inside the loop would throw an error.  Using the <-> 
> operator (also pointing back from the loop variable to the array) tells it to 
> use the Perl 5 behavior, where the array can be changed by changing the loop 
> variable.

Thanks, Aaron, good explanation.  But can you find a description of
'<->' in the Perl 6 docs?

I did a search here

  
https://raw.githubusercontent.com/perl6/mu/master/docs/Perl6/Cheatsheet/cheatsheet.txt

here

  https://doc.perl6.org/language/operators

and here:

  https://doc.perl6.org/language.html

and couldn't find it.

Cheers!

-Tom


Re: is there a Perl 5 converter?

2016-01-21 Thread Aaron Baugher
Tom Browder  writes:

> Thanks, Aaron, good explanation.  But can you find a description of
> '<->' in the Perl 6 docs?

It's mentioned here: https://doc.perl6.org/language/control#for

And here, where it's called the "double-ended arrow", though I don't know how
official that name is: https://design.perl6.org/S04.html#The_for_statement

I don't know if it's actually an operator, which may be why it's hard to find.


-- 
Aaron -- aaron.baugher.biz


Re: is there a Perl 5 converter?

2016-01-21 Thread Patrick R. Michaud
On Thu, Jan 21, 2016 at 01:39:15PM -0600, Aaron Baugher wrote:
> Tom Browder  writes:
> 
> > Thanks, Aaron, good explanation.  But can you find a description of
> > '<->' in the Perl 6 docs?
> 
> It's mentioned here: https://doc.perl6.org/language/control#for
> 
> And here, where it's called the "double-ended arrow", though I don't know how
> official that name is: https://design.perl6.org/S04.html#The_for_statement
> 
> I don't know if it's actually an operator, which may be why it's hard to find.

'<->' isn't an operator, it's one of the tokens that introduces a pointy block 
term.  It's the "default to rw" form of '->' for declaring a block with 
parameters.

Pm


[perl #127308] Configure.pl with moar fails to find C compiler on older Darwin

2016-01-21 Thread Tobias Leich via RT
Does that mean that we *always always always* have a gcc binary?


[perl #127341] LTA error message mentions $!tai ( Duration.new(∞) )

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


Code:
my $x = Duration.new(∞)

Result:
Type check failed in assignment to $!tai; expected Rat but got Num
  in block  at -e line 1


Sure, it could error out on ∞, but it should not mention some internal
variables that are not in my code (especially if the name is so
meaningless).


Re: is there a Perl 5 converter?

2016-01-21 Thread Tom Browder
On Thu, Jan 21, 2016 at 1:39 PM, Aaron Baugher  wrote:
> Tom Browder  writes:
>
>> Thanks, Aaron, good explanation.  But can you find a description of
>> '<->' in the Perl 6 docs?
>
> It's mentioned here: https://doc.perl6.org/language/control#for
...
> I don't know if it's actually an operator, which may be why it's hard to find.

Thanks, Aaron!

-Tom


[perl #127342] LTA error message talks about BOOTSTRAPATTR (say Int.^attributes)

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


Code:
say Int.^attributes

Result:
Method 'gist' not found for invocant of class 'BOOTSTRAPATTR'
  in block  at -e line 1


Ahh… I find this thing pretty annoying. If it has no attributes then I
expect an empty list. If it has some attributes but cannot print them for
some reason then I would like to see a readable error message.

Current error message is kinda ok but it is very unfriendly.


[perl #127308] Configure.pl with moar fails to find C compiler on older Darwin

2016-01-21 Thread Tobias Leich via RT
Can't we do something like this[^1] on darwin also?

[^1] https://github.com/MoarVM/MoarVM/blob/master/build/setup.pm#L445

Like, checking for the existance of clang, and falling back to gcc?


Re: [perl #127308] Configure.pl with moar fails to find C compiler on older Darwin

2016-01-21 Thread Brandon Allbery
On Thu, Jan 21, 2016 at 2:29 PM, Tobias Leich via RT <
perl6-bugs-follo...@perl.org> wrote:

> Can't we do something like this[^1] on darwin also?
>
> [^1] https://github.com/MoarVM/MoarVM/blob/master/build/setup.pm#L445
>
> Like, checking for the existance of clang, and falling back to gcc?
>

gcc and llvm-gcc-4.2 are symlinks to clang in later versions of xcode, so
that should work.

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