diff --git a/README b/README index 6a9e0c28999..6a541eba6ba 100644 --- a/README +++ b/README @@ -23,9 +23,9 @@ or the spectest suite you may also need a subversion (svn) client. In order to fully support Unicode, you'll also want to have the ICU library installed (L). Rakudo can run without ICU, but some Unicode-related features -may not work properly. +do not work properly. -As an example, on Debian GNU/Linux or Ubuntu Linux the necessary +As an example, on Debian GNU/Linux or Ubuntu Linux, the necessary components for building Rakudo can be installed via the command aptitude install build-essential libicu-dev subversion @@ -43,10 +43,16 @@ downloading Rakudo directly from github and building from there: $ git clone git://github.com/rakudo/rakudo.git If you don't have git installed, you can get a tarball or zip of Rakudo -from github by visiting http://github.com/rakudo/rakudo/tree/master -and clicking "Download". Then unpack the tarball or zip. +from L. +Then unpack the tarball or zip. -Once you have a copy of Rakudo, build it as follows: +If you already have cloned Rakudo from github, you can get (pull) the +most recent version from github like this: + + $ cd rakudo + $ git pull + +Once you have an updated copy of Rakudo, build it as follows: $ cd rakudo $ perl Configure.pl --gen-parrot @@ -70,7 +76,7 @@ privileges necessary. The C<--gen-parrot> above option tells Configure.pl to automatically download and build the most appropriate version of Parrot into a local "parrot/" subdirectory, install that Parrot into -the "parrot_install/" subdirectory, and use that for building +the C subdirectory, and use that for building Rakudo. It's okay to use the C<--gen-parrot> option on later invocations of Configure.pl; the configure system will re-build Parrot only if a newer version is needed for whatever version @@ -98,9 +104,26 @@ the Parrot installation that was used to create it remains intact). If the Rakudo compiler is invoked without an explicit script to run, it enters a small interactive mode that allows PerlĀ 6 statements -to be executed from the command line. Each line entered is treated -as a separate compilation unit, however (which means that subroutines -are preserved after they are defined, but variables are not). +to be executed from the command line. + +=head3 Build/install problems + +Occasionally, there may be problems when building/installing Rakudo. +Make sure you have a backup of any custom changes you have done to the +source tree before performing the following steps: + +Try to remove the C subdirectory: + + $ cd rakudo + $ rm -r parrot_install + $ git pull + $ perl Configure.pl --gen-parrot + $ make + +Or, in case you are really stuck, start with a fresh source tree: + + $ rm -r rakudo + $ git clone git://github.com/rakudo/rakudo.git =head2 Running the test suite @@ -168,7 +191,7 @@ Rakudo's official web site is L, where you can find useful information for developers and users alike. There's also a Parrot blog at L, most PerlĀ 6 related news is assembled at L. Links to many other -resources can be found on L. +resources can be found on L. =head2 Reporting bugs @@ -177,8 +200,9 @@ Bug reports should be sent to C with the moniker it gets appropriately tagged in the RT system (https://rt.perl.org/rt3/). Please include or attach any sample source code that exhibits the bug, and include either the release name/date or the git commit -identifier. You find that identifier in the first output line of -the C command. There's no need to cc: the perl6-compiler +identifier. You find that information in the output from +C (or in the first line of C, if Rakudo +fails to build). There's no need to cc: the perl6-compiler mailing list, as the RT system will handle this on its own. =head2 Submitting patches @@ -188,17 +212,17 @@ submit it to C with the moniker [PATCH] (including the brackets) at the start of the subject line. We'll generally accept patches in any form if we can get them to work, but unified diff from the C command is greatly preferred. In -general this means that in the C directory you make your +general this means that in the C directory you make your changes, and then type - git commit -m 'Your commit message' + git commit -m 'Your commit message' changed/filename.pm git format-patch HEAD^ This will generate a file called C<001-your-commit-message.patch>, or more of them if you made multiple commits; please attach these to your email. (Note to the maintainers: you can apply these patches with the -C command; it preserves meta information like author). +C command; it preserves meta information like author). Other ways to create and submit patches are discussed here: L. @@ -210,7 +234,8 @@ See F. =head1 AUTHOR Patrick Michaud C is the primary author and -maintainer for Rakudo Perl 6 on Parrot. +maintainer for Rakudo Perl 6 on Parrot. See F for further +authors. =cut diff --git a/build/Makefile.in b/build/Makefile.in index 7bd32d31dd2..cc53c6e13c1 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -252,6 +252,7 @@ CLEANUPS = \ $(PERL6_EXE) \ perl6.c \ perl6$(O) \ + perl6_group.* \ Test.pir \ $(DYNEXT_DIR)/*$(LOAD_EXT) \ src/gen/core.pm \ @@ -273,7 +274,7 @@ CLEANUPS = \ $(OPS_DIR)/*.c \ $(OPS_DIR)/*$(O) \ $(OPS_DIR)/*$(LOAD_EXT) \ - binder/*$(O) \ + src/binder/*$(O) \ # NOTE: eventually, we should remove --keep-exit-code and --fudge # as the goal is that all tests must pass without fudge diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm index cedda45d3bf..11c64f2dfd8 100644 --- a/src/Perl6/Grammar.pm +++ b/src/Perl6/Grammar.pm @@ -528,6 +528,7 @@ token term:sym { { } token term:sym { } token term:sym { } +token term:sym<**> { <.panic('HyperWhatever (**) not yet implemented')> } token term:sym<*> { } token term:sym { } # token term:sym { } # see colonpair instead diff --git a/src/Perl6/Module/Loader.pm b/src/Perl6/Module/Loader.pm index e347926e4b8..a6c22344592 100644 --- a/src/Perl6/Module/Loader.pm +++ b/src/Perl6/Module/Loader.pm @@ -129,10 +129,22 @@ method stub_lexical_imports($name, $block_ast) { pir::die("Can't import symbol " ~ $_.key ~ " because it already exists in this lexical scope\n"); } else { - $block_ast[0].push(PAST::Var.new( - :name($_.key), :scope('lexical'), :isdecl(1), - :viviself(PAST::Op.new( :pirop('null P')) ) - )); + if pir::isa($_.value, 'Perl6MultiSub') { + $block_ast[0].push(PAST::Var.new( + :name($_.key), :scope('lexical'), :isdecl(1), + :viviself(PAST::Op.new( + :pasttype, :name, + PAST::Op.new( :pirop, 'Perl6MultiSub'), + PAST::Op.new( :pirop, $_.key ) + )) + )); + } + else { + $block_ast[0].push(PAST::Var.new( + :name($_.key), :scope('lexical'), :isdecl(1), + :viviself(PAST::Op.new( :pirop('null P')) ) + )); + } $block_ast.symbol($_.key, :scope('lexical')); } } @@ -151,7 +163,15 @@ method import($name) { my %imports := self.get_imports($name); unless pir::isnull__IP(%imports) { for %imports { - $targetns{$_.key} := $_.value; + # If the symbol is a multi-sub, then we need to incorporate + # these new candidates into it. Otherwise, just install the + # symbol. + if pir::isa($_.value, 'Perl6MultiSub') { + $targetns{$_.key}.incorporate_candidates($_.value); + } + else { + $targetns{$_.key} := $_.value; + } } } diff --git a/src/core/operators.pm b/src/core/operators.pm index d02a7eee796..43a1fa8c5f4 100644 --- a/src/core/operators.pm +++ b/src/core/operators.pm @@ -368,9 +368,13 @@ our multi sub infix:<...>(@lhs is copy, $rhs) { } } - my sub is-on-the-wrong-side($first , $before_last , $last , $limit) { + my sub is-on-the-wrong-side($first , $second , $third , $limit , $is-geometric-switching-sign) { return Bool::False if $limit ~~ Whatever; - ($before_last > $last && $limit > $first) || ($before_last < $last && $limit < $first); + if $is-geometric-switching-sign { + ($second.abs >= $third.abs && $limit.abs > $first.abs) || ($second.abs <= $third.abs && $limit.abs < $first.abs); + } else { + ($second >= $third && $limit > $first) || ($second <= $third && $limit < $first); + } } my $limit; @@ -391,11 +395,11 @@ our multi sub infix:<...>(@lhs is copy, $rhs) { if $diff == 0 { $next = succ-or-pred2(@lhs[*-2], @lhs[*-1], $rhs) } elsif @lhs.elems == 2 || @lhs[*-2] - @lhs[*-3] == $diff { - return Nil if is-on-the-wrong-side(@lhs[0] , @lhs[*-2] , @lhs[*-1] , $rhs); + return Nil if is-on-the-wrong-side(@lhs[0] , @lhs[*-2] , @lhs[*-1] , $rhs , Bool::False); $next = { $_ + $diff }; } elsif @lhs[*-2] / @lhs[*-3] == @lhs[*-1] / @lhs[*-2] { $is-geometric-switching-sign = (@lhs[*-2] * @lhs[*-1] < 0); - return Nil if is-on-the-wrong-side(@lhs[0] , @lhs[*-2] , @lhs[*-1] , $rhs) && !$is-geometric-switching-sign; + return Nil if is-on-the-wrong-side(@lhs[*-3] , @lhs[*-2] , @lhs[*-1] , $rhs , $is-geometric-switching-sign) ; my $factor = @lhs[*-2] / @lhs[*-3]; if $factor ~~ ::Rat && $factor.denominator == 1 { $factor = $factor.Int; @@ -412,28 +416,35 @@ our multi sub infix:<...>(@lhs is copy, $rhs) { gather { my @args; - my $j; + my $previous; my $top = $arity min @lhs.elems; - for @lhs.kv -> $i, $v { - $j = $v; - take $v; - @args.push($v) if $i >= @lhs.elems - $top; - } + my $lhs-orig-count = @lhs.elems ; + my $count=0; - if !$limit.defined || $limit cmp $j != 0 { + if @lhs || !$limit.defined || $limit cmp $previous != 0 { loop { - my $i = $next.(|@args) // last; - my $j = $i; + @args.push(@lhs[0]) if @lhs && $count >= $lhs-orig-count - $top; + my $current = @lhs.shift() // $next.(|@args) // last; my $cur_cmp = 1; if $limit.defined { - $cur_cmp = $limit cmp $j; - last if (@args[*-1] cmp $limit) == $cur_cmp && !$is-geometric-switching-sign; + $cur_cmp = $limit cmp $current; + if $previous.defined { + my $previous_cmp = $previous cmp $limit; + if ($is-geometric-switching-sign) { + $cur_cmp = $limit.abs cmp $current.abs; + $previous_cmp = $previous.abs cmp $limit.abs; + } + last if @args && $previous_cmp == $cur_cmp ; + } } - take $j; + $previous = $current; + take $current ; + $count++; + last if $cur_cmp == 0; - @args.push($j); + @args.push($previous) if $count > $lhs-orig-count; while @args.elems > $arity { @args.shift; } diff --git a/t/spectest.data b/t/spectest.data index 279bc7fc72b..b066bb75e60 100644 --- a/t/spectest.data +++ b/t/spectest.data @@ -451,7 +451,7 @@ S12-methods/syntax.t S12-methods/topic.t S12-methods/typed-attributes.t S12-methods/what.t -# S12-subset/multi-dispatch.t +S12-subset/multi-dispatch.t # S12-subset/subtypes.t S13-type-casting/methods.t S13-overloading/typecasting-long.t @@ -512,6 +512,7 @@ S32-array/rotate.t S32-array/shift.t S32-array/splice.t S32-array/unshift.t +S32-basics/warn.t # S32-container/zip.t S32-hash/exists.t S32-hash/delete.t @@ -583,6 +584,7 @@ S32-str/ucfirst.t # icu S32-str/uc.t # icu # S32-str/unpack.t S32-str/words.t # icu +S32-temporal/calendar.t S32-temporal/Date.t S32-temporal/DateTime.t S32-trig/e.t