[perl #77270] [BUG] LTA error message when misspelling type names in signatures in Rakudo

2010-08-17 Thread Carl Mäsak
# New Ticket Created by  Carl Mäsak 
# Please include the string:  [perl #77270]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77270 


masak rakudo: sub foo(-- NoSuchType) { say OH HAI }
p6eval rakudo b64718: OUTPUT«===SORRY!===␤Unable to parse
postcircumfix:sym( ), couldn't find final ')' [...]
masak rakudo: class A { method foo(-- NoSuchType) { say OH HAI } }
p6eval rakudo b64718: OUTPUT«===SORRY!===␤Malformed method at line
22, near foo(-- No␤»
masak both these error messages could be improved to indicate the
actual problem.
moritz_ agreed
* masak submits rakudobug
masak std: sub foo(-- NoSuchType) { say OH HAI }
p6eval std 32024: OUTPUT«===SORRY!===␤No type
found after -- [...]
masak std: class A { method foo(-- NoSuchType) { say OH HAI } }
p6eval std 32024: OUTPUT«===SORRY!===␤No type
found after -- [...]
masak 'No type found' isn't spot on either, but it's much better.


[perl #77272] [BUG] LTA error message when misspelling a type name after inheritance 'is' in class declaration in Rakudo

2010-08-17 Thread Carl Mäsak
# New Ticket Created by  Carl Mäsak 
# Please include the string:  [perl #77272]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77272 


masak rakudo: class A is NoSuchType {}
p6eval rakudo 85602a: OUTPUT«===SORRY!===␤No applicable candidates
found to dispatch to for 'trait_mod:is'. Available candidates
are:␤:(Mu $child, Role $r)␤:(Routine $r, Any
:default($default)!)␤:(Code $block, Any $arg?, Any
:export($export)!)␤:(Mu $child, Mu $parent)␤:(Mu $type where ({ ...
}), Any [...]
masak when I make a typo in the type after 'is', I'm less interested
in the available candidates to trait_mod:is and more interested in
line number and file.
* masak submits rakudobug


[perl #77274] [BUG] Class cannot inherit first from parent and then from grandparent in Rakudo

2010-08-17 Thread Carl Mäsak
# New Ticket Created by  Carl Mäsak 
# Please include the string:  [perl #77274]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77274 


masak rakudo: class A { method foo { say OH HAI } }; class B is A
{}; class C is A is B {}; say alive; C.new.*foo
p6eval rakudo 85602a: OUTPUT«===SORRY!===␤Could not build C3
linearization: ambiguous hierarchy␤»
* masak submits rakudobug
masak it's a good day when I find something amiss in the OO system. :)
masak rakudo: class A { method foo { say OH HAI } }; class B is A
{}; class C is B is A {}; say alive; C.new.*foo
p6eval rakudo 85602a: OUTPUT«alive␤OH HAI␤»
masak interesting.

Apart from some cases of MRO, the order of the parent classes
shouldn't matter in the declaration.


Re: slurpy hash

2010-08-17 Thread Darren Duncan

David H. Adler wrote:

Hm. So how are valid parameter names defined? Identifiers in perl6 seem
to be composed of letters, digits and underscores (and hyphens and
apostrophes between letters). Are parameter names defined differently?
You certainly seem to be able to declare a variable $1.


I believe that Perl 6 identifiers can be any string at all, but that then they 
have to appear quoted in the general case; the above restriction just refers to 
the common case of unquoted identifiers.  This said, I'm not sure yet what the 
syntax is for quoting identifiers. -- Darren Duncan


Re: Large integers, ** and Int

2010-08-17 Thread Aaron Sherman
Re-sending my message which went to parrot-dev, and should have gone to
perl6-compiler. Sorry.

On Tue, Aug 17, 2010 at 6:48 PM, Aaron Sherman a...@ajs.com wrote:


 On Tue, Aug 17, 2010 at 11:51 AM, Moritz Lenz mor...@faui2k3.org wrote:

 Aaron Sherman wrote:
  I did eventually discover that I needed to do this. The problem then
  became that I can't reliably get exporting an infix:+ operator from a
  module to work.

 When you try, make sure to declare it as 'our', since Rakudo doesn't
 fully handle lexical exports yet.

 # probably also needs type constraints
 our multi sub infix:+($a, $b) is export {
# your code here
 }


 This is what my signature looks like right now (I've re-named my module
 BigTest just to avoid confusion while I develop):

  our multi sub infix:+(BigTest $lhs, BigTest $rhs) is export {
 return BigTest.new(:value(Q:PIR {
   ...
 };
 }

 When I use that file, and try to add:

 ./perl6 -e 'use BigTest; my BigTest $i .=
 new(:value(1)); $i = $i + $i; say $i'

 I get:

 Type check failed for assignment
   in 'infix:=' at line 1
   in main program body at line 1

 If I comment out the Numeric method in my class, then that error changes
 to:

 Can't take numeric value for object of type BigTest
   in 'Any::Numeric' at line 1339:CORE.setting
   in 'infix:+' at line 6752:CORE.setting
   in main program body at line 1

 So it looks like it's just totally unwilling to try to use that inline:+
 that I've defined, and instead is dead-set on trying to convert my BigTest
 to a Numeric in order to match an alternate signature.

 --
 Aaron Sherman
 Email or GTalk: a...@ajs.com
 http://www.ajs.com/~ajs



[perl #70600] [BUG] Rakudo gets confused when the exponent in scientific notation is large enough

2010-08-17 Thread Will Coleda via RT
On Tue Nov 17 08:32:14 2009, masak wrote:
 diakopter rakudo: say 0e999 # masak
 p6eval rakudo 7347ec: undefined identifier 'NaN' [...]
 moritz_ ng: say 0e999
 p6eval ng 94fa72: error:imcc:syntax error, unexpected IDENTIFIER,
 expecting COMMA or ')' ('NaN')
 diakopter whoa
 * masak submits rakudobug

00:29 [Coke] rakudo: say 0e999
00:29 p6eval rakudo 67778a: OUTPUT«NaN␤»

That looks better. assigning to moritz++ for testification.


-- 
Will Coke Coleda


[perl #69518] [BUG] Rakudo allows instantiating subtypes, shouldn't

2010-08-17 Thread Will Coleda via RT
On Thu Oct 01 03:44:43 2009, masak wrote:
 masak rakudo: subset Foo of Object where Str | Int; my $foo =
 Foo.new; say $foo.WHAT
 p6eval rakudo ffe648: OUTPUT«()␤»
 * masak submits another rakudobug
 
 Should probably be a compile-time error, even.

This better?

00:30 [Coke] rakudo: subset Foo of Object where Str | Int; my $foo = Foo.new; 
   say $foo.WHAT
00:30 p6eval rakudo 67778a: OUTPUT«===SORRY!===␤Confused at line 22, near 
   subset Foo␤»

-- 
Will Coke Coleda


[perl #74352] [BUG] Strange type object-related error when doing a junction in a subtype with the same nominal check several times in Rakudo

2010-08-17 Thread Will Coleda via RT
On Tue Apr 13 09:22:39 2010, masak wrote:
 masak rakudo: subset A of Array; subset B of A; subset C of A;
 subset D of A where B  C; say [] ~~ D
 p6eval rakudo 3b5a79: OUTPUT«Type objects are abstract and have no
 attributes, but you tried to access [...]
 * masak submits rakudobug
 masak it appears to be a combination of doing the nominal A check
 multiple times, and the 
 masak rakudo: subset A of Array; subset B of A; subset C of Any;
 subset D of A where B  C; say [] ~~ D
 p6eval rakudo 3b5a79: OUTPUT«Type objects are abstract and have no
 attributes, but you tried to access [...]
 masak rakudo: subset A of Array; subset B of Any; subset C of Any;
 subset D of A where B  C; say [] ~~ D
 p6eval rakudo 3b5a79: OUTPUT«1␤»
 
 Also, 'tried to access' what exactly?

Slightly more verbose now:

00:35 p6eval rakudo 67778a: OUTPUT«Type objects are abstract and have no 
   attributes, but you tried to access $!flat␤  in 'infix:' at 
   line 1␤  in anon at line 22:/tmp/hSDtzs8cFQ␤  in 
   'Block::ACCEPTS' at line 5766:CORE.setting␤  in 'ACCEPTS' at 
   line 984:CORE.setting␤  in 'ACCEPTS' at line 981:CORE.setting␤ 


-- 
Will Coke Coleda


[perl #77124] [BUG] 'perl6 --help' doesn't give any help in Rakudo

2010-08-17 Thread Will Coleda via RT
On Mon Aug 09 23:53:11 2010, masak wrote:
 mantovan guys hi
 mantovan I download rakudo, and when I try do perl6 --help I get,
 mantovan http://nopaste.snit.ch/22656
 mantovan the error ^
 mantovan or perl6 help, perl6 h
 
 Here's the nopaste:
 
 Unable to open filehandle from path 'h'
 current instr.: 'perl6;PCT;HLLCompiler;evalfiles' pc 1303
 (compilers/pct/src/PCT/HLLCompiler.pir:707)
 called from Sub 'perl6;PCT;HLLCompiler;command_line' pc 1489
 (compilers/pct/src/PCT/HLLCompiler.pir:794)
 called from Sub 'perl6;Perl6;Compiler;main' pc -1 ((unknown file):-1)
 
 masak mantovani: thanks for making us aware of this. I will submit a
 ticket about it, and it'll hopefully get fixed for the next release.
 * masak submits rakudobug about 'perl6 --help' not working

We have help now:

$ ./perl6 --help
./perl6
  This compiler is based on PCT::HLLCompiler.

  Options:
e=s
help|h
target=s
dumper=s
trace|t=s
encoding=s
output|o=s
combine
version|v
stagestats

$ ./perl6 --version

This is Rakudo Perl 6, version 2010.07-140-g67778a6 built on parrot 2.7.0 r48560

Copyright 2008-2010, The Perl Foundation



assigning to moritz++ for testing.
-- 
Will Coke Coleda


[perl #76436] rakudo parses 555 ~~!~~ 666 but STD doesn't

2010-08-17 Thread Will Coleda via RT
On Fri Jul 09 03:45:52 2010, pawel.pab...@implix.com wrote:
 [12:43] bbkr std: 555 ~~!~~ 666
 [12:43] p6eval std 31588:
 OUTPUT«===SORRY!===␤Expecting a
 term, but found either infix ~~ or redundant prefix ~␤  (to suppress
 this
 message, please use space between ~ ~) at /tmp/EZ59HXaH3Q line
 1:␤-- 
 [32m555 ~~!~~⏏ 666␤Parse failed␤FAILED 00:01 112m␤»
 [12:43] bbkr rakudo: 555 ~~!~~ 666
 [12:43] p6eval rakudo 1086ff:  ( no output )
 
 
 [12:44] jnthn heh
 [12:44] jnthn bet it parsed as
 [12:44] jnthn 555 ~~ !(~(~(666)))

This is actually failing differently via evalbot  the REPL:

  555 ~~!~~ 666
Confused at line 1, near  555 ~~!~~

but:

00:50 [Coke] rakudo: 555 ~~!~~ 666
00:50 p6eval rakudo 67778a:  ( no output )


-- 
Will Coke Coleda


[perl #74654] [BUG] '$b()' is parsed wrongly by Rakudo

2010-08-17 Thread Will Coleda via RT
On Sun Apr 25 07:22:56 2010, masak wrote:
 JimmyZ masak: alpha is diferent from rakudo
 JimmyZ masak: which one is right?
 JimmyZ alpha: my $b = time; say $b();
 p6eval alpha 30e0ed: OUTPUT«1272203938.46735␤»
 JimmyZ rakudo: my $b = time; say $b();
 p6eval rakudo e393c7: OUTPUT«␤»
 masak rakudo: my $b = time; say $b();
 p6eval rakudo e393c7: OUTPUT«1272203984.27821␤»
 masak JimmyZ: viv seems to indicate that alpha was right there.
 masak i.e. that $b() should be parsed as ($b).()
 * masak submits rakudobug

Error has changed:

00:53 [Coke] rakudo: my $b = time; say $b();
00:53 p6eval rakudo 67778a: OUTPUT«===SORRY!===␤Non-declarative sigil is 
   missing its name at line 22, near $b();␤»


-- 
Will Coke Coleda


[perl #73740] [BUG] Parsefail when semicolon missing from 'use' statement in Rakudo

2010-08-17 Thread Will Coleda via RT
On Mon Mar 22 07:28:11 2010, masak wrote:
 Bug courtesy of uasi on Twitter:
 http://twitter.com/uasi/status/10873572370.
 
 masak rakudo: use Test;
 jnthn But that came to and end a while ago. :-)
 p6eval rakudo 35f337:  ( no output )
 masak rakudo: use Test
 masak long delays... :/
 p6eval rakudo 35f337:  ( no output )
 masak locally, when I have a file with just 'use A;', it works fine.
 If I remove the semicolon, it says 'confused'.
 jnthn std: use A;
 jnthn std: use A
 p6eval std 30169: OUTPUT«Potential difficulties:␤  Can't locate
 module A at /tmp/FQGpoIxpTk line 1:␤-- use
 A⏏;␤ok 00:02 106m␤»
 p6eval std 30169: OUTPUT«Potential difficulties:␤  Can't locate
 module A at /tmp/hIrELZGAXV line 1 (EOF):␤-- use
 A⏏EOL␤ok 00:01 104m␤»
 jnthn :-/
 masak both are equally ok.
 jnthn agree
 jnthn file Rakudo bug if Rakudo refuses to accept the latter.
 * masak files rakudobug
 
 Just for completeness...
 
 $ cat A.pm
 say OH HAI;
 $ cat test
 use A
 $ perl6 test
 OH HAI
 Confused at line 1, near use A\n
 [...]

This seems to work now:
$ cat A.pm 
say OH HAI;
$ cat test
use A
$ ./perl6 test
OH HAI


... no trailing confusion. assigning to moritz++ for testing.


-- 
Will Coke Coleda


[perl #74822] [BUG] Too many CR in a for loop with %

2010-08-17 Thread Will Coleda via RT
On Sat May 01 07:09:45 2010, richardh wrote:
 see IRC #perl6 1 May
 
 finanalyst: rakudo: my %h=a b c Z 1,2,3; for %h { .say }
 p6eval: rakudo c4857a: OUTPUT«a 1␤b 2␤c 3␤␤»
 snip
 finanalyst: masak: i think there should only be one CR not two in the 
 rakudo output
 masak: yes, now I see it.
 masak: rakudo: my %h=a b c Z 1,2,3; say +%h
 p6eval: rakudo c4857a: OUTPUT«3␤»
 masak: odd.
 finanalyst: shall i report a bug?
 masak: please do.
 
 

This is fixed:

01:02 [Coke] rakudo: my %h=a b c Z 1,2,3; for %h { .say }
01:02 p6eval rakudo 67778a: OUTPUT«a  1␤b  2␤c  3␤»

Assigning to moritz++ for testing.
-- 
Will Coke Coleda


[perl #64124] Segmentation fault in embedding Parrot into Perl 5

2010-08-17 Thread Will Coleda via RT
On Mon Mar 23 13:09:56 2009, szab...@gmail.com wrote:
 I am not sure if this is a Parrot or Rakudo bug
 or just a plain invalid usage on my side.
 
 The following code runs, prints the prompt but when I
 enter a response I get a Segmentation fault.
 
 Gabor
 
 
 #!/usr/bin/perl
 use strict;
 use warnings;
 
 
 # Needs two environment variables:
 # PARROT_DIR needs to point to the directory where parrot was checked out
 # export LD_LIBRARY_PATH=$PARROT_DIR/blib/lib/
 
 # cwd still needs to be PARROT_DIR or I get the following error:
 #load_bytecode couldn't find file 'PCT.pbc'
 #current instr.: '' pc 743 (src/classes/Object.pir:20)
 #called from Sub 'myperl6' pc 3 (EVAL_1:3)
 
 # Before running I had to build Parrot::Embed:
 # cd $ENV{PARROT_DIR}/ext/Parrot-Embed/
 # perl Build.PL
 # perl Build
 # perl Build test
 
 
 die need PARROT_DIR if not $ENV{PARROT_DIR};
 unshift @INC, (
   $ENV{PARROT_DIR}/ext/Parrot-Embed/blib/lib,
   $ENV{PARROT_DIR}/ext/Parrot-Embed/blib/arch,
   );
   
 require Parrot::Embed;
 my $interp = Parrot::Interpreter-new;
 
 my $perl6 =END_PIR;
 .sub myperl6
 .param stringin_string
 load_bytecode '$ENV{RAKUDO_DIR}/perl6.pbc'
 
 \$P0 = get_hll_global 'prompt'
 .tailcall \$P0('Enter your name: ')
 .end
 END_PIR
 
 my $eval = $interp-compile( $perl6 );
 my $foo = $interp-find_global('myperl6');
 my $pmc = $foo-invoke( 'PS', 'say hello' );
 print $pmc-get_string(), \n;

Gabor -


Sorry for the delay in responding. This ticket is over a year old - can you 
still reproduce this 
problem?
-- 
Will Coke Coleda


[perl #72830] [BUG] Parse difficulties with '::%%r' in Rakudo

2010-08-17 Thread Will Coleda via RT
On Mon Feb 15 01:50:21 2010, masak wrote:
 diakopter std: my %r = 4; say ::%%r
 p6eval std 29733: OUTPUT«ok 00:01 107m␤»
 diakopter rakudo: my %r = 4; say ::%%r
 p6eval rakudo 70667a: OUTPUT«Confused at line 11, near say
 ::%%r␤current instr.: 'perl6;HLL;Grammar;panic' pc 500
 (ext/nqp-rx/src/stage0/HLL-s0.pir:328)␤»
 diakopter I don't know whether that's a rakudobug, stdbug, both, or
 neither.
 TimToady std: :: % %r
 p6eval std 29733: OUTPUT«Potential difficulties:␤  Variable %r is
 not predeclared at /tmp/BecvEU8Bg6 line 1:␤-- :: %
 %r⏏EOL␤ok 00:01 106m␤»
 diakopter rakudobug, then
 * masak submits it

New failure mode:

01:14 [Coke] rakudo: my %r = 4; say ::%%r
01:14 p6eval rakudo 67778a: OUTPUT«===SORRY!===␤ResizablePMCArray: Can't pop 
   from an empty array!␤»

-- 
Will Coke Coleda


[perl #75620] some exceptions throw you out of the rakudo shell

2010-08-17 Thread Will Coleda via RT
On Tue Jun 08 12:33:03 2010, cognominal wrote:
 I golfed the problematic statement to :
 
 $ perl6
   lc ~$_ for Match.^methods
   lc ~$_ for Match.^methods
 get_string() not implemented in class 'ArrayIterator'
 $ say my mac is freaking me out  # oops I was thrown out from the
 rakudo shell
 

$ ./perl6 
 lc ~$_ for Match.^methods
Method 'methods' not found for invocant of class 'P6metaclass'
 lc ~$_ for Match.^methods
Method 'methods' not found for invocant of class 'P6metaclass'
 lc ~$_ for Match.^methods
Method 'methods' not found for invocant of class 'P6metaclass'
 lc ~$_ for Match.^methods
Method 'methods' not found for invocant of class 'P6metaclass'
 say my mac is freaking me out # oops I was thrown out from the rakudo shell
my mac is freaking me out

This appears to be working now:
$ ./perl6 --version

This is Rakudo Perl 6, version 2010.07-140-g67778a6 built on parrot 2.7.0 r48560

Copyright 2008-2010, The Perl Foundation

Thanks for the report.

-- 
Will Coke Coleda