Giter Site home page Giter Site logo

rakudo / rakudo Goto Github PK

View Code? Open in Web Editor NEW
1.7K 1.7K 372.0 71.91 MB

🦋 Rakudo – Raku on MoarVM, JVM, and JS

Home Page: https://rakudo.org/

License: Artistic License 2.0

Java 1.81% C 0.97% Perl 1.22% C++ 0.06% JavaScript 0.28% Makefile 0.32% Shell 0.15% Batchfile 0.01% PowerShell 0.19% Raku 95.01%
hacktoberfest moarvm nqp raku rakudo

rakudo's People

Contributors

ab5tract avatar alexdaniel avatar altai-man avatar coke avatar colomon avatar froggs avatar hoelzro avatar jdv avatar jnthn avatar kaiepi avatar lizmat avatar masterduke17 avatar moritz avatar mouq avatar niner avatar particle avatar patrickbkr avatar patzim avatar perlpilot avatar peschwa avatar pmichaud avatar pmurias avatar samcv avatar tbrowder avatar timo avatar timtoady avatar ugexe avatar usev6 avatar vrurg avatar zoffixznet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rakudo's Issues

Improve "Return outside of routine" error

UPDATE: Ignore OP; the actual problem is a poor error


OP:

<Zoffix__> m: sub { 1.map: { return 42 } }()
<camelia> rakudo-moar 1251f771c: OUTPUT: «Attempt to return outside of any Routine␤  in block <unit> at <tmp> line 1␤␤»


<Zoffix__> bisect: sub { 1.map: { return 42 } }()
<bisectable6> Zoffix__, On both starting points (old=2015.12 new=f40babb) the exit code is 1 and the output is identical as well
<bisectable6> Zoffix__, Output on both points: «Attempt to return outside of any Routine␤  in block <unit> at /tmp/6LvcPFlvmv line 1␤»

Silent Failure When Binding To Map Key

The second line of this code silently fails to bind a new value:

my $h := Map.new: (:42foo);
$h<foo> := 100;
say $h;  # OUTPUT: Map.new((foo => 42))

Presumably, the Failure doesn't explode because variable assignment/binding doesn't sink the returned values, BUT it does work correctly when trying the same thing with a List:

my $h := Map.new: (:42foo);
my $x = ($h<foo> := 100);
say $h;                 # OUTPUT: Map.new((foo => 42))
say $x.^name;           # OUTPUT: Failure
say $x.exception.^name; # OUTPUT: X::Bind
my $h := Map.new: (:42foo);
sink $h<foo> := 100;

# Cannot bind to Map
#  in block <unit> at test.p6 line 2
my $list := <foo bar ber>;
$list[0] := 100;

Cannot use bind operator with this left-hand side
  in block <unit> at test.p6 line 5

is DEPRECATED doesn't work on Routines in precomped modules

Foo.pm:

class A {
    method a() is DEPRECATED<b> {
    }
}

$ perl6 --ll-exception -I. -MFoo -e 'dd A.a'
Cannot invoke this object (REPR: Null; VMNull)
   at SETTING::src/core/traits.pm:150  (/Users/liz/Github/rakudo.moar/install/share/perl6/runtime/CORE.setting.moarvm:)
 from /Users/liz/Github/rakudo.moar/Foo.pm6 (Foo):3  (/Users/liz/Github/rakudo.moar/.precomp/E7148DC9FED15B480AF079994892987152D023CD.1509221700.44536/20/201A6B3053CC1422D2C3670B62616221D2290929:a)
 from -e:1  (<ephemeral file>:<unit>)
 from -e:1  (<ephemeral file>:<unit-outer>)

Regex bug on custom <ws>

grammar { token ws { \s+ }; token zs { \s+ }; token TOP {['if' | 'if' <.zs> 'else'] $} }.parse("if else").say # OUTPUT: «「if else」␤»

grammar { token ws { \s+ }; token zs { \s+ }; token TOP {['if' | 'if' <.ws> 'else'] $} }.parse("if else").say # OUTPUT: «Nil␤»

zs was used to confirm ws was treated as non-declarative, even after you've redefined it in a declarative way.

Whitespacey things in «» (say «a\nb».perl)

This issue is an attempt to give RT#76120 a new life.

Code:

say «a\ b».perl # OUTPUT: «("a", "b")»

The behavior is consistent across all rakudo releases to date (2015.12⌁2017.10).

If “\ ” is equivalent to “ ” (just space), then what's the point of that functionality? Or, if there's a good justification for this behavior, then what is it?

Same goes for other spacey things:

say «a\tb».perl # OUTPUT: «("a", "b")»
say «a\nb».perl # OUTPUT: «("a", "b")»

IMO all these should produce one element where the whitespace is part of the string (“a b”, “a\tb” and “a\nb”).

This case is even more interesting:

say «a b».perl # OUTPUT: «("a", "b")»
say «a b».perl # OUTPUT: «"a b"»

What‽ Yes, it's \c[NO-BREAK SPACE].

Supply.list returns a Seq

Supply.list would make a really good (better than inheriting from Any) implementation of Supply.Seq. Actually, we should just rename that method to Seq, since:

$ perl6-m -e 'say Supply.interval(2).list.WHAT'
(Seq)

A list method returning a Seq is less than great, though. I suggest after renaming the current list to Seq, we then implement Supply.list as self.Seq.list.

Compiler version (perl6 -v): This is Rakudo version 2017.09-479-g7cf5ce7 built on MoarVM version 2017.09.1-614-g1952356 implementing Perl 6.c.

Fix frugal quant on the JVM

The repetition register needs to be saved in quant when executing the thing being quantified.

Causes bugs in:

t/spec/S05-modifier/perl5_5.t
t/spec/S05-modifier/perl5_9.t

splice slips replacement lists

The Problem

When using splice with a @replacement, the replacement seems to get "slipped" into the list

my @c = ('A', 1), ('B', 2), ('D', 4);
my $x = ('C', 3);
@c.splice(2, 0, $x);
say @c.perl;    # OUTPUT: [("A", 1), ("B", 2), "C", 3, ("D", 4)]

In order to make splice keep the nesting, you need to manually add it back in

@c.splice(2, 0, [$x]);
say @c.perl;    # OUTPUT: [("A", 1), ("B", 2), ("C", 3), ("D", 4)]

Expected Behavior

When providing a list as a replacement (or insertion as the case may be), replacement list should keep their container.

my @c = ('A', 1), ('B', 2), ('D', 4);
my $x = ('C', 3);
@c.splice(2, 0, $x);
say @c.perl;    # OUTPUT: [("A", 1), ("B", 2), ("C", 3), ("D", 3)]

If the current behavior of splice is wanted, the user can simply Slip the list as is common in Perl 6

@c.splice(2, 0, |$x);

It is a fairly established behavior in Perl 6 that containers are not slipped/flattened unless explicitly asked. This is how push or unshift works, and I think splice should work the same.

my @c = ('A', 1), ('B', 2), ('C', 3);
my $x = ('D', 3);
@c.push($x);
say @c.perl;    # OUTPUT: [("A", 1), ("B", 2), ("C", 3), ("D", 3)]

Actual Behavior

See Problem

Steps to Reproduce

See Problem

Environment

  • Operating system: Linux
  • Compiler version (perl6 -v): This is Rakudo version 2017.10-85-g5e7dfe5 built on MoarVM version 2017.10-29-g116c7a1

Broken default value assignment on shaped array attributes

The Problem

class F { 
    has @.color[4] = <1 2 3 4>;
}; 
my $f = F.new();
say $f.color

Expected Behavior

$f.color == <1 2 3 4>

Actual Behavior

$f.color == [(Any) (Any) (Any) (Any)]

Environment

Seems to happen in 2017.09 and HEAD version used by the m bot in #perl6

Nil ignores default value in parameter list

Currently Nil is assigned to the parameter even though a default value is assigned.

sub f($a = 42){ say $a }; f Nil;
# rakudo-moar 17db03eb3: OUTPUT: «Nil␤»

This is at best surprising and may lead to undefined behaviour of a program as a default value is meant to replace and as such avoid undefined values in the routine. Using the default value when Nil is assinged would avoid that problem.

One complication would be a is raw parameter that got a default value (what in itself may be problematic). As is raw is meant to pass whatever is provided as an argument to the routine. In this case Nil should be passed on even if there is a default value.

see discussion at https://irclog.perlgeek.de/perl6/2017-11-10#i_15429754

Uncurse work broke Match unpacking with Str() coercer

Zoffix │ m: if "1" ~~ /(\d)/ -> $ (Str() $_) {.say}
camelia │ rakudo-moar 4fca94743: OUTPUT: «Cannot find method 'say': no method cache and no .^find_method␤  in block <unit> at <tmp> line 1␤␤»
Zoffix │ mc: if "1" ~~ /(\d)/ -> $ (Str() $_) {.say}
committabl+│ Zoffix, ¦2015.12: «1»


bisectable+│ Zoffix, bisect log: https://gist.github.com/e32a7eb0419b04fca429a757d5295221
bisectable+│ Zoffix, There are 20 candidates for the first “new” revision. See the log for more details

https://gist.github.com/e32a7eb0419b04fca429a757d5295221

Fix backtracking a subrule

We need to remove captures from the cstack when backtracking a subrule
Causes a fudge on the JVM S05-match/capturing-contexts.t
Fixed on the JS backend in nqp commit 626e60c81f6140d1a04021522e361ba2208132e5

Postfix hyper confusing: `>>(&func)`

rakudo/src/Perl6/Actions.nqp

Lines 7511 to 7547 in 2377624

method postfixish($/) {
if $<postfix_prefix_meta_operator> {
my $past := $<OPER>.ast || QAST::Op.new( :name('&postfix' ~ $*W.canonicalize_pair('', $<OPER>.Str)),
:op<call> );
if $past.isa(QAST::Op) && $past.op() eq 'callmethod' {
self.hyper-nodal-name-tweak($past);
$past.name('dispatch:<hyper>');
}
elsif $past.isa(QAST::Op) && $past.op() eq 'call' {
if $<dotty> {
$past.name('&METAOP_HYPER_CALL');
}
else {
my $basepast := $past.name
?? QAST::Var.new( :name($past.name), :scope<lexical>)
!! $past[0];
$past.push($basepast);
$past.name('&METAOP_HYPER_POSTFIX_ARGS');
}
}
# Check if we are inside «...» quoters and complain if the hyper creates
# ambiguity with the quoters, since user may not wanted to have a hyper
if ($/.pragma("STOPPER") // '')
eq (my $sym := $<postfix_prefix_meta_operator>[0]<sym>)
{
$/.worry(
"Ambiguous use of $sym; use "
~ ($sym eq '>>' ?? '»' !! '>>')
~ " instead to mean hyper, or insert whitespace before"
~ " $sym to mean a quote terminator (or use different delimiters?)"
)
}
make $past;
}
}

> [1,2,3]>>(&say)
1sub say (| is raw) { #`(Sub|140355192792552) ... }
2sub say (| is raw) { #`(Sub|140355192792552) ... }
3sub say (| is raw) { #`(Sub|140355192792552) ... }

I don't know even how this code can run, most of time it expects a postfix operator, so this code should die, shouldn't it?

Would be nice to have an easy way to work with SetHashes and its kin

Based on discussion on RT#132352, it would be nice if you could have a %- sigiled var to worth with SetHash and its kin and so you could use meta-assign form of set ops, like ∖=

[...] make the following variation of it work:

    my %days is SetHash = Date.today … Date.new: '2014-04-02';
    %days ∖= %days.grep: *.key.day-of-week > 5;
    %days{Date.today}:delete;

...and then promote %-sigiled SetHash variables as the recommended way to store SetHash'es.

It should be possible to make this last example work by implementing `method STORE` for type SetHash, right?

(That it currently doesn't, may well be an oversight rather than a design choice.)

Can’t override !~, =~, >>, <<

How to reproduce

sub infix:<!~> { say @_ }; 3 !~ 4

Expected behavior

Prints [3 4].

Actual behavior

Exits with the following error: Unsupported use of !~ to do negated pattern matching; in Perl 6 please use !~~.

This also happens with =~, <<, >>, and possibly others.

Version information

This is Rakudo version 2017.09 built on MoarVM version 2017.09.1
implementing Perl 6.c.

Caller-$/-setting is too invasive

This started with RT#126721 that points out .subst's replacement block has wrong $/ if caller's $/ is read-only. The bug was originally fixed by having .subst throw in such circumstances, just like .match and .trans do (now reverted).

This fix caused breakage in about 20 modules and when I went to fix it I ended up staring at diffs like this, with a dozen changes, all just to rename a variable, all just because a .subst call was used.

This is what the users would regularly have to do in their grammar actions, since $/ is the common name for the parameter. For that reason, I propose we go into the opposite direction and instead don't set caller's $/ in method forms. Off the top of my head, that'd affect .parse, .subparse, .match, .trans (currently throw on read-only $/) and .subst and .subst-mutate (currently silently fail). .comb with regex might be also in the list, except it already appears it does not touch $/.

The operator forms (/.../, s/...//, S/...//, and tr///) on the other hand would set $/. Unlike operators, methods are often chained, and at least to me feel like they shouldn't be messing with variables in my current scope.

So "foo" ~~ /(f)(.)(.)/ would set $/ and the user can obtain captures from it. "foo".match: /(f)(.)(.)/ would not and it'd be assumed the user would be chaining it with something and using the return value.

One obvious implementation would be to add something like :$RAKUDO-INTERNAL-SET-DOLLAR-SLASH parameter to the methods that operators would set, since they're implemented in terms of those methods. The arg could also be made public API (e.g. :$set-match), so users could set it in method forms to affect the $/ . Finally, the back-compat way to do this could be to add a reverse arg: one that makes method forms NOT touch $/ but IMO that feels like a bandaid over the issue and users would still get confusing errors when using these methods in grammar actions, except instead of telling them to rename the parameter we'd be telling them to set an arg.

This change would break 6.c tests, so it's 6.d material.

Rakudo repo cleanup (mainly tools/ directory)

In a comment section of 99f38f9 it was mentioned that rakudo git repo has some scripts that are likely unused, or simply do not belong to the repo. Let's assess the situation and clean it up a little bit.

⚠ Feel free to edit this post. Mark a file with ✓ if it was moved, removed or if it's decided that it should stay. Replace “⁇” with any helpful commentary.

  • tools
  • ├── autounfudge.pl – ⁇
  • ├── available-pm-names.pl6 – deleted in 825a8b0
  • ├── benchmark.pl – ⁇
  • ├── build
  • │   ├── common_bootstrap_sources – ⁇
  • │   ├── create-jvm-runner.pl – ⁇
  • │   ├── create-moar-runner.pl – ⁇
  • │   ├── gen-cat.nqp – ⁇
  • │   ├── gen-version.pl – ⁇
  • │   ├── install-core-dist.pl – ⁇
  • │   ├── jvm_core_d_sources – ⁇
  • │   ├── jvm_core_sources – ⁇
  • │   ├── Makefile-common-macros.in – ⁇
  • │   ├── Makefile-common-rules.in – ⁇
  • │   ├── Makefile-JVM.in – ⁇
  • │   ├── Makefile-Moar.in – ⁇
  • │   ├── makeMAGIC_INC_DEC.pl6 – ⁇
  • │   ├── makeNATIVE_ARRAY.pl6 – ⁇
  • │   ├── makeNATIVE_SHAPED_ARRAY.pl6 – ⁇
  • │   ├── makeSLICE.pl6 – ⁇
  • │   ├── makeUNIPROP.pl6 – ⁇
  • │   ├── missing-commits.pl6 – compared to releasable the script probably doesn't do enough, so either delete or move to rakudo/release repo (deleted in 6ec6f1e)
  • │   ├── moar_core_d_sources – ⁇
  • │   ├── moar_core_sources – ⁇
  • │   ├── nqp-jvm-rr.pl – ⁇
  • │   ├── NQP_REVISION – this file should absolutely stay, but is it the best place for it?
  • │   └── upgrade-repository.pl – ⁇
  • ├── build-localtest.pl – ⁇
  • ├── commit-stats.pl – deleted in 028b7d2
  • ├── contributors.pl6 – part of the release process. Move to rakudo/release repo?
  • ├── create-release-announcement.pl6 – part of the release process. Move to rakudo/release repo?
  • ├── CREDITS.pl6 – ⁇
  • ├── install-dist.pl – ⁇
  • ├── lib
  • │   └── NQP
  • │       └── Configure.pm – used by Configure.pl
  • ├── perl6-limited.pl – ⁇
  • ├── progress-graph.pl – deleted in 5baede5
  • ├── rakudo-swarm.config – ⁇
  • ├── release-dates.pl – it is used once in forever. Let's golf it and then it can be included in the release docs
  • ├── update-passing-test-data.pl – ⁇
  • ├── update-tai-utc.pl – updates leap seconds
  • └── util
  •     └── perlcritic.conf – ⁇

Overriding precedence of ops silently fails for existing ops

If you override an op with same fixity and symbol as an already-existing op, trying to change its precedence will silently fail.

https://irclog.perlgeek.de/perl6/2017-11-06#i_15410194

16:20 	Zoffix 	m: sub infix:<zzz> is tighter(&[+]) { &CORE::infix:</>($^a, $^b) }; say 2 + 2 zzz 2; { sub infix:<zzz> is looser(&[+]) { &CORE::infix:</>($^a, $^b) }; say 2 + 2 zzz 2 }
16:20 	camelia 	rakudo-moar e3f6ababf: OUTPUT: «3␤3␤»
16:21 	Zoffix 	Yeah, I'd call that a bug. Your code can change from under you because the shadowing of existing ops is only half-done

This also affects overriding precedence of existing core ops. There's a short-circuit in the grammar that bails out of defining a new grammar for an op if we already have the rule for it. I think this bug can be fixed by just making that bail out smarter and making it check the configuration of the existing and wanted op match.

CLOSE phaser can have busted outer scope

The Problem

This workaround is required, otherwise the wrong $!socket may be closed, due to CLOSE having the wrong outer scope.

Expected Behavior

The code using CLOSE would work the same as the code using on-close.

Actual Behavior

CLOSE fires with the wrong outer chain. The wrong socket gets closed. Bad things happen.

Steps to Reproduce

  1. Revert the workaround.
  2. Run t/http-client.t in Cro::HTTP on a slow or overloaded machine (whatever Travis CI uses triggers it, I never managed to do it locally).

Environment

  • Operating system: Ubuntu 16.04
  • Compiler version (perl6 -v): 2017.10

Unsure of method subparse, parameter %*opt 's behavior

method subparse(\target, :$rule, :$args, :$actions) is raw {
nqp::stmts(
(my $grammar := self.new(:orig(target), |%_).set_actions($actions)),
nqp::decont(nqp::getlexcaller('$/') =
nqp::if(
$rule,
nqp::if(
$args,
$grammar."$rule"(|$args.Capture).MATCH,
$grammar."$rule"().MATCH,
),
nqp::if(
$args,
$grammar.TOP(|$args.Capture).MATCH,
$grammar.TOP().MATCH
),
)
)
)
}

grammar Number { rule TOP { <[A..Z]>+ } }
say Number.subparse("ABCDE", :pos(4));
# OUTPUT: 「E」
grammar Number { rule TOP { <[a..z]>+ } }
say Number.subparse("ABCDE", :i);
# OUTPUT: #<failed match>

Docs on the doc site says every adverb of regex matching can be applied.

https://docs.perl6.org/type/Grammar#method_subparse

However,

rakudo/src/core/Match.pm

Lines 820 to 828 in f8e1a5f

submethod BUILD(
:$orig = '',
:$from = 0,
:to(:$pos),
:ast(:$made),
:$shared,
:$braid,
:$list,
:$hash)

seems not all of them.

Could anyone familiar with Grammar please tell me how %*opt behavior?

@AlexDaniel @lizmat @TimToady @moritz

Async qqx sometimes hangs or dies ( await (^5).map({start { say qqx{… …} } }) )

Code:

await (^5).map({start { say qqx{echo -n foo $_} } })

But it does not always crash, so chances are you will need to run it like this in your shell:

while perl6 -e 'await (^5).map({start { say qqx{echo -n foo $_} } })'; do :; done

There are different ways you can observe the bug. Sometimes it hangs, sometimes it prints this:

foo 2
foo 4
foo 1
foo 0
Tried to get the result of a broken Promise
  in block <unit> at -e line 1

Original exception:
    This type (Nil+{Mu::Suggestion[Str]}) does not support elems
      in block  at -e line 1

The error message can be different. I've also seen This representation (Uninstantiable) does not support elems (for type (null)).

The problem is reproducible on 2017.09 and HEAD(3f595ac), so maybe it's not a regression (at least not a fresh one).

See also RT #132287 and especially this comment.

Serialization of Hashes parametarized with DefiniteHOW types is busted

IRC: https://irclog.perlgeek.de/perl6/2017-10-24#i_15345736

./script.p6:

use lib '.';
use Bug;
sub here-transform { my Int:D % = :1a }
my Int:D %exp = :1a;
say module-transform().perl; # (my Int:D % = :a(1))
say   here-transform().perl; # (my Int:D % = :a(1))
say               %exp.perl; # (my Int:D % = :a(1))
say module-transform() eqv %exp; # False
say   here-transform() eqv %exp; # True

dd [module-transform().WHAT, %exp.WHAT, module-transform().WHAT === %exp.WHAT];
# [Hash[Int:D], Hash[Int:D], Bool::False]

./Bug.pm6:

our sub module-transform { my Int:D % = :1a }
$ perl6 script.p6
(my Int:D % = :a(1))
(my Int:D % = :a(1))
(my Int:D % = :a(1))
False
True
[Hash[Int:D], Hash[Int:D], Bool::False]

Something is busted with serialization of hashes typed with DefiniteHOW types (e.g. Int:D). In particular, the produced .WHATs are not at the same address and don't match nqp::eqaddr() which causes eqv op to return False.

The same issue doesn't exist if we use just Int type constraint. Or if no precompilation; is used in the module.

Uninitialized $_ and weird blowage (<a b c>[$_ xx 2] with 1)

Let's say you want to achieve something like this:

say <a b c>[1 xx 2] # OUTPUT: «(b b)␤»

But using $_:

<a b c>[$_ xx 2] with 1
Use of Nil in string context
  in block  at -e line 1
Unable to call postcircumfix [ (Any) ] with a type object
Indexing requires a defined object
  in block <unit> at -e line 1

So not only $_ is unitialized, but it is also trying to stringify something? Weird.

HyperIterables ignore loop phasers

my @a = (^10).list; @a = @a.hyper(:batch(5)).map({ LAST say "last"; „∅“ });
# rakudo-moar d10d69774: ( no output )

# expexted output at the end of a batch:
# last

# FIRST and NEXT are ignored too
# It may be sensible to fail on LAST in a HyperIterable and provide a
# LAST-BATCH phaser to avoid confusion when non-parallel code is
# changed.

LTA error with `is rw` defaults in an unpacked slurpy

https://irclog.perlgeek.de/perl6-dev/2017-10-25#i_15352946

2017.09.474 zoffix@VirtualBox~$ perl6 -e 'm: sub foo(+$x [$ is rw = False]) { $x }; say foo().perl;'
Unhandled exception: concatenate requires a concrete string, but got null
   at SETTING::src/core/Exception.pm:395  (/home/zoffix/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:print_exception)
 from SETTING::src/core/Exception.pm:452  (/home/zoffix/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:<anon>)
 from gen/moar/stage2/NQPHLL.nqp:1708  (/home/zoffix/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
 from src/Perl6/Compiler.nqp:42  (/home/zoffix/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:1630  (/home/zoffix/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm:command_line)
 from gen/moar/main.nqp:47  (/home/zoffix/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm:MAIN)
 from gen/moar/main.nqp:38  (/home/zoffix/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm:<mainline>)
 from <unknown>:1  (/home/zoffix/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm:<main>)
 from <unknown>:1  (/home/zoffix/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm:<entry>)


2017.09.474 zoffix@VirtualBox~$ perl6 -v
This is Rakudo version 2017.09-474-g765dd69 built on MoarVM version 2017.09.1-609-g1a9be0a
implementing Perl 6.c.

Unhandled exception: This representation (VMException) does not support attribute storage

Came across this while doing some DIHWIDT, figured I'd file it in case this crash is hiding the real error:

$ perl6 -v
This is Rakudo version 2017.11-2-g575d31e built on MoarVM version 2017.11
implementing Perl 6.c.

$ cat Foo.pm6 
BEGIN True does False;

$ perl6 -I. -MFoo -e ''
Unhandled exception: This representation (VMException) does not support attribute storage (for type BOOTException)
   at SETTING::src/core/Exception.pm:395  (/home/zoffix/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:print_exception)
 from SETTING::src/core/Exception.pm:452  (/home/zoffix/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:<anon>)
 from gen/moar/stage2/NQPHLL.nqp:1708  (/home/zoffix/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
 from src/Perl6/Compiler.nqp:42  (/home/zoffix/rakudo/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:1630  (/home/zoffix/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
 from gen/moar/main.nqp:47  (/home/zoffix/rakudo/install/share/perl6/runtime/perl6.moarvm:MAIN)
 from gen/moar/main.nqp:38  (/home/zoffix/rakudo/install/share/perl6/runtime/perl6.moarvm:<mainline>)
 from <unknown>:1  (/home/zoffix/rakudo/install/share/perl6/runtime/perl6.moarvm:<main>)
 from <unknown>:1  (/home/zoffix/rakudo/install/share/perl6/runtime/perl6.moarvm:<entry>)

SEGV when running whateverable tests

OK, this bug report is not extremely useful, but that's about all I can do.

See Raku/whateverable#24 (comment) for some commentary on what happens.

Here's the SEGV caught with gdb: https://gist.github.com/MasterDuke17/0312dd2af1e3b2b498d91cfacc45343c

To reproduce on your own machine you'll need a local irc server, hundreds of rakudo builds and a lot of perl6 modules installed. That's very unlikely, so it's much easier to contact me if you want to play with it. I'll give you access to the server where whateverable runs, the crash is easily reproducible there.

Some discussion: https://irclog.perlgeek.de/perl6/2017-11-19#i_15471050

This is a regression, but I can't tell when it happened. Definitely there was at least one release with this bug included.

This is Rakudo version 2017.10-215-g85105077a built on MoarVM version 2017.10-86-g89fae17a6
implementing Perl 6.c.

Compound junction-assignement operators cause a hang

How to reproduce

$_ = 42; say $_ &= 3

Expected behavior

Prints all(42, 3) or something similar. Maybe warn about the usage of &=.

Actual behavior

perl6 hangs. This also happens with |= and ^=.

Version information

This is Rakudo version 2017.09 built on MoarVM version 2017.09.1
implementing Perl 6.c.

[NativeCall] Test failure on ARM (32 bits)

The Problem

Test failure on ARM (32 bits).

Actual Behavior

$ ./perl6 t/04-nativecall/02-simple-args.t
1..14
ok 1 - passed int 42
ok 2 - passed two shorts
ok 3 - passed an int32, int16 and int8
ok 4 - passed a double
ok 5 - passed a float
ok 6 - passed a string
ok 7 - checked previously passed string
ok 8 - wrapped sub
ok 9 - passed int64 0xFFFFFFFFFF
ok 10 - passed uint8 0xFE
not ok 11 - passed uint16 0xFFFE
# Failed test 'passed uint16 0xFFFE'
# at t/04-nativecall/02-simple-args.t line 62
# expected: '11'
#      got: '0'
ok 12 - passed uint32 0xFFFFFFFE
ok 13 - passed size_t 42
ok 14 - passed ssize_t -42
# Looks like you failed 1 test of 14

Environment

$ uname -srm
Linux 4.13.12-sunxi armv7l
$ lsb_release -d
Description:	Debian GNU/Linux 9.2 (stretch)
$ ./perl6 -v
This is Rakudo Star version 2017.10 built on MoarVM version 2017.10
implementing Perl 6.c.

Rakudo 2017.10 fails to build on Debian big endian systems

make[1]: Entering directory '/<<PKGBUILDDIR>>'
perl Configure.pl --prefix=/usr --libdir=/usr/lib/perl6 --backends=moar
Unhandled exception: Bytecode validation error at offset 150, instruction 24:
out of range SC index 56283
   at <unknown>:1  (/usr/share/nqp/lib/ModuleLoader.moarvm:<load>)
 from <unknown>:1  (/usr/share/nqp/lib/nqp.moarvm:<dependencies+deserialize>)

===SORRY!===
Unable to read configuration from NQP on MoarVM

To automatically clone (git) and build a copy of NQP 2017.10,
try re-running Configure.pl with the '--gen-moar' option.
Or, use '--prefix=' to explicitly specify the path where the NQP and MoarVM
executables can be found that are use to build Rakudo.

debian/rules:21: recipe for target 'override_dh_auto_configure' failed

s390x powerpc ppc64 fail in a similar way

Test Summary Report
-------------------
t/02-rakudo/repl.t                        (Wstat: 256 Tests: 39 Failed: 1)
  Failed test:  34
  Non-zero exit status: 1
Files=67, Tests=839, 380 wallclock secs ( 1.20 usr  0.27 sys + 865.60 cusr 434.20 csys = 1301.27 CPU)
Result: FAIL
Makefile:568: recipe for target 'm-coretest5' failed

More details are available on rakudo buildd page

Debian bugs:

Note that rakudo is built on Debian with the latest released version of libtommath.

All the best

[Need] Recursively deal with pod-table

The Problem

Now we handle pod-table assuming all its rows contain raw string. However, users might want to embed pod code with pod-table, especially C<>. Can we recursively deal with pod table?

Below are code relevant IMO.

rakudo/src/Perl6/Actions.nqp

Lines 1106 to 1108 in d6cd0d2

method pod_block:sym<delimited_table>($/) {
make Perl6::Pod::table($/);
}

rakudo/src/Perl6/Actions.nqp

Lines 1343 to 1349 in d6cd0d2

method table_row($/) {
make ~$/
}
method table_row_or_blank($/) {
make ~$/
}

our sub table($/) {

Expected Behavior

Treat text in pod table raw as pod6 code.

Actual Behavior

Raw string.

Steps to Reproduce

=begin table
    $*ARGFILES        | An C<IO::CatHandle> that uses C<@*ARGS> as source
                      | files, if it contains any files, or C<$*IN> otherwise
    ------------------+--------------------------------------------
    @*ARGS            | B<Arguments> from the I<command line>.
    ------------------+--------------------------------------------
=end table

say $=pod;

[Pod::Block::Table
  $["\$*ARGFILES", "An C<IO::CatHandle> that uses C<\@*ARGS> as source files, if it contains any files, or C<\$*IN> otherwise"]
  $["\@*ARGS", "B<Arguments> from the I<command line>."]
]

Environment

  • Operating system: Mac OS X 10.12.6
  • Compiler version (perl6 -v):
This is Rakudo version 2017.10-125-g360eb2289 built on MoarVM version 2017.10-57-gd257df23
implementing Perl 6.c.

Some custom ops with weird chars fail to work

With some weird Unicode chars for custom operators, the definition succeeds and installs the op, but trying to use it fails.

I think these should either work, or the definition should complain about invalid character.

$ perl6 -v
This is Rakudo version 2017.11-2-g575d31e built on MoarVM version 2017.11
implementing Perl 6.c.

$ perl6 -e 'sub infix:«"z"» ($,$) { say "here" }; "42 z 42".EVAL'
here

$ perl6 -e 'sub infix:«"\x[2028]"» ($,$) { say "here" }; "42 \x[2028] 42".EVAL'
===SORRY!=== Error while compiling /home/zoffix/EVAL_0
Confused
at /home/zoffix/EVAL_0:2
------> 42⏏ 
    expecting any of:
        infix
        infix stopper
        statement end
        statement modifier
        statement modifier loop

"trans" method does not remove complement characters in some cases

The Problem

"trans" method does not work as expected.

"string".trans("tz" => "", :complement, :delete) # works
"string".trans("xz" => "", :complement, :delete) # does not work

Expected Behavior

Should remove all complement characters

Actual Behavior

Removes complement characters only if at least one of original was in a string.

Steps to Reproduce

"string".trans("xz" => "", :complement, :delete) # does not work

Environment

  • Operating system: Windows 10
  • Compiler version (perl6 -v):
    This is Rakudo version 2017.07 built on MoarVM version 2017.07
    implementing Perl 6.c.

List.new creates unwanted containers

List.new uses **@items to gather stuff to make a list out of, but that gives each item an own container, which produces a mutable List:

[14:04] <asdsdfgh> m: my $l := List.new: 42; say $l[0] = 42;
[14:04] <+camelia> rakudo-moar 8ccb60e39: OUTPUT: «42␤»

Instead, the method should probably just do something similar to what &infix:<,> does

MoarVM panic: Could not spawn thread: errorcode -11

This reliably fails on camelia bot: (-11... segfault?)

m: await ^60 .map: { start sleep ⅓ }
rakudo-moar ae1f0fdaf: OUTPUT: «MoarVM panic: Could not spawn thread: errorcode -11␤»

This doesn't happen with the same bot using 2017.07 release, suggesting it might be a regression:

star: await ^60 .map: { start sleep ⅓ }
star-m 2017.07: ( no output )

Also it doesn't happen with committable bot on HEAD either:

c: HEAD await ^600 .map: { start sleep ⅓ }
Zoffix, ¦HEAD(ae1f0fd): «»

So maybe the error is due to some ulimit or something? Doesn't seem to be it; replicated the entire ulimit setup from camelia's box on my local box and can't repro the issue locally.

Range.sum() on infinite Ranges

Here is current (at time of writing) implementation of Range.sum()

method sum() is nodal {
    my ($start,$stop) = self.int-bounds || nextsame;
    my $elems = 0 max $stop - $start + 1;
    ($start + $stop) * $elems div 2;
}

If int-bounds fails, nextsame jumps to Any.sum()... which iterates the invocant and adds each iteration until IterationEnd. This means attempting to sum an infinite range will never terminate, eg. (1..*).sum.

Besides an infinite Range, the smallest Range I could find (on my machine) that would fail int-bounds is (0 .. 1e309). I tried to sum that on my machine but gave up waiting after about 30 mins.

With that in mind... is there any reason why Range.sum() shouldn't just check self.is-lazy and if True, throw something like "Cannot sum infinite Range"

Rakudo is not building on Windows

First, I installed MoarVM and NQP by checking out the master branch and running in each directory:

perl Configure.pl --prefix="D:\rakudo" --make-install

To install rakudo, I tried the above command, then I tried it with --backends=moar, then without --make-install and running gmake separately. The result was the same. This is the part that failed:

D:\rakudo\bin\nqp-m.bat --target=mbc --output=blib/Perl6/World.moarvm --encoding=utf8
src/Perl6/World.nqp
While looking for 'Perl6/ModuleLoader.moarvm': no such file or directory
at src\vm\moar\ModuleLoader.nqp:51 (D:\rakudo\share\nqp\lib/ModuleLoader.moarvm:)
from src\vm\moar\ModuleLoader.nqp:41 (D:\rakudo\share\nqp\lib/ModuleLoader.moarvm:load_module)
from gen\moar\stage2\NQP.nqp:262 (D:\rakudo\share\nqp\lib\nqp.moarvm:load_module)
from gen\moar\stage2\NQP.nqp:2414 (D:\rakudo\share\nqp\lib\nqp.moarvm:statement_control:sym)
from gen\moar\stage2\QRegex.nqp:1683 (D:\rakudo\share\nqp\lib/QRegex.moarvm:!reduce)
from gen\moar\stage2\QRegex.nqp:1629 (D:\rakudo\share\nqp\lib/QRegex.moarvm:!cursor_pass)
from :1 (D:\rakudo\share\nqp\lib\nqp.moarvm:statement_control:sym)
from gen\moar\stage2\QRegex.nqp:1721 (D:\rakudo\share\nqp\lib/QRegex.moarvm:!protoregex)
from :1 (D:\rakudo\share\nqp\lib\nqp.moarvm:statement_control)
from gen\moar\stage2\NQP.nqp:952 (D:\rakudo\share\nqp\lib\nqp.moarvm:statement)
from :1 (D:\rakudo\share\nqp\lib\nqp.moarvm:statementlist)
from gen\moar\stage2\NQP.nqp:919 (D:\rakudo\share\nqp\lib\nqp.moarvm:comp_unit)
from gen\moar\stage2\NQP.nqp:817 (D:\rakudo\share\nqp\lib\nqp.moarvm:TOP)
from gen\moar\stage2\QRegex.nqp:2330 (D:\rakudo\share\nqp\lib/QRegex.moarvm:parse)
from gen\moar\stage2\NQPHLL.nqp:1886 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:parse)
from gen\moar\stage2\NQPHLL.nqp:1802 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:execute_stage)
from gen\moar\stage2\NQPHLL.nqp:1835 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:run)
from gen\moar\stage2\NQPHLL.nqp:1838 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:)
from gen\moar\stage2\NQPHLL.nqp:1824 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:compile)
from gen\moar\stage2\NQPHLL.nqp:1524 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:eval)
from gen\moar\stage2\NQPHLL.nqp:1779 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:evalfiles)
from gen\moar\stage2\NQPHLL.nqp:1704 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:command_eval)
from gen\moar\stage2\NQPHLL.nqp:1630 (D:\rakudo\share\nqp\lib/NQPHLL.moarvm:command_line)
from gen\moar\stage2\NQP.nqp:4123 (D:\rakudo\share\nqp\lib\nqp.moarvm:MAIN)
from gen\moar\stage2\NQP.nqp:4118 (D:\rakudo\share\nqp\lib\nqp.moarvm:)
from :1 (D:\rakudo\share\nqp\lib\nqp.moarvm:

)
from :1 (D:\rakudo\share\nqp\lib\nqp.moarvm:)
makefile:448: recipe for target 'blib/Perl6/World.moarvm' failed
gmake: *** [blib/Perl6/World.moarvm] Error 1

My toolchain is Strawberry Perl (v5.24.1). Windows 10.

Note: when I deleted the prefix directory and tried to build rakudo with --gen-moar --gen-nqp, I got the following error:

src\io\asyncsocket.c: In function 'push_name_and_port':
src\io\asyncsocket.c:484:5: error: unknown type name 'in_port_t'
in_port_t port;
^
makefile:578: recipe for target 'src\io\asyncsocket.o' failed
gmake: *** [src\io\asyncsocket.o] Error 1
The system cannot find the path specified.
Cleaning up ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.