...
 
Commits (4)
......@@ -641,6 +641,7 @@ U: paultcochrane
E: paul@liekut.de
N: Paweł Murias
N: Pawel Murias
U: pmurias
E: pawelmurias@gmail.com
......
......@@ -361,7 +361,7 @@ MAIN: {
sorry($options{'ignore-errors'}, @errors) if @errors;
my $l = uc $backend_prefix{$default_backend};
print $MAKEFILE qq[\nt/*/*.t t/*.t t/*/*/*.t: all\n\t\$(${l}_HARNESS_WITH_FUDGE) --verbosity=1 \$\@\n];
print $MAKEFILE qq[\nt/*/*.t t/*.t t/*/*/*.t: all\n\t\$(${l}_HARNESS5_WITH_FUDGE) --verbosity=1 \$\@\n];
close $MAKEFILE or die "Cannot write 'Makefile': $!";
......
......@@ -127,6 +127,7 @@ docs/announce/2018.06.md
docs/announce/2018.08.md
docs/announce/2018.09.md
docs/announce/2018.10.md
docs/announce/2018.11.md
docs/architecture.html
docs/architecture.svg
docs/archive/2017-IO-Grant--Action-Plan.md
......@@ -255,6 +256,7 @@ src/core/Grammar.pm6
src/core/Hash.pm6
src/core/hash_slice.pm6
src/core/HyperConfiguration.pm6
src/core/Hyper.pm6
src/core/HyperSeq.pm6
src/core/Instant.pm6
src/core/Int.pm6
......@@ -451,6 +453,8 @@ src/Perl6/PodGrammar.nqp
src/Perl6/Pod.nqp
src/Perl6/World.nqp
src/RESTRICTED.setting
src/vm/js/CompUnit/Repository/FileSystemWithRecording.pm6
src/vm/js/load-compiler.nqp
src/vm/js/make-release.js
src/vm/js/ModuleLoaderVMConfig.nqp
src/vm/js/Perl6/Ops.nqp
......
rakudo (2018.11-1) unstable; urgency=medium
* New upstream version 2018.11
* control: update moarvm-dev and nqp dep versions
-- Robert Lemmen <robertle@semistable.com> Sat, 01 Dec 2018 19:09:33 +0100
rakudo (2018.10-1) unstable; urgency=medium
* New upstream version 2018.10
......
......@@ -13,8 +13,8 @@ Build-Depends: debhelper (>= 9),
libreadline-dev,
libtommath-dev,
libuv1-dev,
moarvm-dev (>= 2018.10),
nqp (>= 2018.10),
moarvm-dev (>= 2018.11),
nqp (>= 2018.11),
perl
Standards-Version: 4.1.4
Vcs-Browser: https://salsa.debian.org/perl6-team/rakudo
......
New in 2018.11:
+ SPECIAL NOTES:
+ 🎆❇️🔥 Default language version is now `v6.d` 🔥❇️🎆 [46ef0ea0]
+ Deprecations:
+ Deprecated `.path`/`.args` in `Proc::Async`, use `.command`
instead [45bbc946]
+ Fixes:
+ Fixed `$*PERL.version` to always report the right version [c9ecfb7a]
+ Consistified `:U.pairup` with `:D.pairup` to return a Seq [d73272e4]
+ Provided a stable `.WHICH` for `Map` [4e0a1c24][052067fd]
+ Made sure `DEPRECATED` reports location correctly when
using `:up` [8561d0ae]
+ Fixed literal `\` in `tr///` [85107ec0]
+ Fixed tap add/remove race in `Supplier` and `Supplier::Preserving`
[7ee1f3c5][68d79e70]
+ `QuantHash`es now properly report `.of` and `.keyof` [8b93ec9f]
+ Added type constraints to port numbers in `IO::Socket::Async` [547f28ba]
+ Fixed re-initialization on some types of arrays [f1fa5adf]
[7262b4e8][49f07abe]
+ Gave 6.d correct `is rw` Proxy semantics [7d37f9aa]
+ Fixed `Match.^roles` [becbdeb9]
+ Fixed missing path volume after `..` is resolved [8854bbd3]
+ The `.values` method can now be used to change values in
object hashes [a728bb2d]
+ Fixed shaped dynamic variables like `my %*a{Int}` [bcdf87a6]
+ Made `my @a is Blob / Buf = ...` work [762c708f]
+ Object hashes and `QuantHash`es can now be used with
metaops [Hyper refactor]
+ Many improvements to the JS backend [32b7c089][f35dd301][9457f7e5]
[ea69c0a0][0e4969fe][9df074ba][78389aa2][1ef62aca][f460ad1a][cbbe16ed]
+ Improved error message when using placeholders with methods [deae5bcd]
[0896c301][48093d0d][0bda7dc1][90103f6d][68b44e33][8549c4c1]
+ Various improvements to produced messages [15c16e35][e6758492]
+ Additions:
+ Implemented `X::Language::TooLate` [3365094f]
+ `$*COLLATION.set` is no longer experimental [20c41ca5]
+ Added dynamic variable `$*FOLDING` [cec1f511]
+ Removals:
+ Removed unspecced `.allowed` attribute in `Pod::Block::Code` [5aba3e96]
+ Set operators `(<+)`, `≼`, `(>+)`, `≽` now die when used [951303f9]
[7a1a1868][81474bf9][5598f37d]
+ `Associative >>op<< Iterable` now dies, as the results are indeterminate
due to random hash key order [Hyper refactor]
+ Build system:
+ Fixed `t/*/*.t` rule in generated Makefile [d2c7e327]
+ Made running timing based tests optional [72b896c8]
+ Efficiency:
+ Made `Int eqv Int` 3x and `int eqv int` 5x as fast [fb9a0454][94dd0a41]
+ Made `ObjAt` `eqv` `ObjAt` also faster [5120d3d2]
+ Made `Hash`/`Map` slices about 5x as fast [6fe27894][b83179f0]
[c4da4c7e][9a2c4b44]
+ Optimized various operations on `Date` and `DateTime` making
them up to 3x as fast [11cb4fac][b6292fe9][08fac045][98d07cf6]
[b463746d][bf3eb8ec][a11d599f]
+ Made metaops use the fast path for `&[+=]`-like ops [e7ce194a]
+ Hyper operator refactor makes many things like
`%h >>+>> 1` 1.3x to 8x as fast [bfe2ad63][130cc817][0bc72e05]
[75c9456a][ec2848c4][f06e8582][73eb297f][194daab7][a575effe]
[c50cf82a][1a2b39dc][307a98bd][843118ea][6208c266][9221c08d]
[c03e71d5][78f64203][63ae9dcc][fa5215b6][d5a751d9][674a0837]
[8fa72681][80edefcf][cf5c8a09][534d8f65][7fad12b0][800d8fbb]
[c3f03e67][1ed2b098][21434dda][234e298b][e8285c01][32ab0d30]
[90ac0940][f7007ac0][dc67ee75][cae9847e][481dbf92][c4445649]
[19f0c842][86ce4f4e][50f2207b][2e5be5b8][1b7253df][64a47d87]
[005261a4][10693d16]
+ Internal:
+ Changed CORE.d setting compilation to propagate indicator flags [4a6d9108]
+ Made sure we don't add object to serialization context more
than once [3995e423]
+ New QAST to mbc compiler [edc4c054][6aafe18d][f8be2fa0][656a8045][bb43acdb]
+ Added `Hash.STORE(\keys,\values)` [faa19ab9]
+ Introduced `R:I.AssociativeIterableKeys` [6fe27894]
+ Various internal optimizations [5f1a81e0][1766435a][8e858c8d][00eb7b85]
[0fa6988c][bf3575cc][18ded174]
New in 2018.10:
+ SPECIAL NOTES:
+ This is the first Rakudo release that comes with an additional
......@@ -18,7 +93,7 @@ New in 2018.10:
+ Fixed indexing of shaped arrays with a dimension higher than 3 [0307c366]
+ `.in-timezone`s value is now coerced to Int [c8438e6a]
+ Stub methods from roles are now verified [fd5d5bdf]
+ Fixed double-closing of handles in `.lines` when `:close` and
+ Fixed double-closing of handles in `IO::Handle.lines` when `:close` and
`$limit` are used [6edb142f]
+ Fixed closing of handles in `IO::Handle.lines` when `$limit`
is used [c1c75740]
......@@ -62,14 +137,14 @@ New in 2018.10:
+ Other minor optimizations [464a86b1][ab83b9d8][8cc3d5d7][b107cda5]
+ Internal:
+ Made `make` an only [369068ae]
+ Added skip-one method to appropriate PredictiveIterators [e54885e5]
+ Added skip-one method to appropriate `PredictiveIterator`s [e54885e5]
+ More things are now initialized at setting compile time
[06dfbf02][688cbac1][92735770]
+ Simplified initialization of `CompUnit::RepositoryRegistry`
[0425d927][8e1cd01a]
+ Introduced `IterationBuffer.List` [8c10da6a]
+ Made it not go through `.new` if we can `nqp::create` [84311b77]
+ Made sure `.STORE` only works on instances [9daac683]
+ Use `nqp::create` for IterationBuffer instead of .new [84311b77]
+ Made sure `.STORE` only works on instances of mixy/baggy types [9daac683]
+ Added `$*INSIDE-EVAL` to mark that we're inside an `EVAL` [73b7c603]
New in 2018.09:
......
......@@ -43,7 +43,7 @@ New in 2018.10:
+ Fixed indexing of shaped arrays with a dimension higher than 3 [0307c366]
+ `.in-timezone`s value is now coerced to Int [c8438e6a]
+ Stub methods from roles are now verified [fd5d5bdf]
+ Fixed double-closing of handles in `.lines` when `:close` and
+ Fixed double-closing of handles in `IO::Handle.lines` when `:close` and
`$limit` are used [6edb142f]
+ Fixed closing of handles in `IO::Handle.lines` when `$limit`
is used [c1c75740]
......@@ -87,14 +87,14 @@ New in 2018.10:
+ Other minor optimizations [464a86b1][ab83b9d8][8cc3d5d7][b107cda5]
+ Internal:
+ Made `make` an only [369068ae]
+ Added skip-one method to appropriate PredictiveIterators [e54885e5]
+ Added skip-one method to appropriate `PredictiveIterator`s [e54885e5]
+ More things are now initialized at setting compile time
[06dfbf02][688cbac1][92735770]
+ Simplified initialization of `CompUnit::RepositoryRegistry`
[0425d927][8e1cd01a]
+ Introduced `IterationBuffer.List` [8c10da6a]
+ Made it not go through `.new` if we can `nqp::create` [84311b77]
+ Made sure `.STORE` only works on instances [9daac683]
+ Use `nqp::create` for IterationBuffer instead of .new [84311b77]
+ Made sure `.STORE` only works on instances of mixy/baggy types [9daac683]
+ Added `$*INSIDE-EVAL` to mark that we're inside an `EVAL` [73b7c603]
......
# Announce: Rakudo Perl 6 compiler, Release #128 (2018.11)
On behalf of the Rakudo development team, I’m very happy to announce the
November 2018 release of Rakudo Perl 6 #128. Rakudo is an implementation of
Perl 6 on the Moar Virtual Machine[^1].
This release implements 6.c and 6.d versions of the Perl 6 specification.
6.c version of the language is available if you use the `use v6.c`
version pragma, otherwise 6.d is the default.
Upcoming releases in 2018 will include new functionality that is not
part of 6.c or 6.d specifications, available with a lexically scoped
pragma. Our goal is to ensure that anything that is tested as part of
6.c and 6.d specifications will continue to work unchanged. There may
be incremental spec releases this year as well.
The tarball for this release is available from <https://rakudo.org/files/rakudo>.
Please note: This announcement is not for the Rakudo Star
distribution[^2] — it’s announcing a new release of the compiler
only. For the latest Rakudo Star release, see
<https://rakudo.org/files/star>.
The changes in this release are outlined below:
New in 2018.11:
+ SPECIAL NOTES:
+ 🎆❇️🔥 Default language version is now `v6.d` 🔥❇️🎆 [46ef0ea0]
+ Deprecations:
+ Deprecated `.path`/`.args` in `Proc::Async`, use `.command`
instead [45bbc946]
+ Fixes:
+ Fixed `$*PERL.version` to always report the right version [c9ecfb7a]
+ Consistified `:U.pairup` with `:D.pairup` to return a Seq [d73272e4]
+ Provided a stable `.WHICH` for `Map` [4e0a1c24][052067fd]
+ Made sure `DEPRECATED` reports location correctly when
using `:up` [8561d0ae]
+ Fixed literal `\` in `tr///` [85107ec0]
+ Fixed tap add/remove race in `Supplier` and `Supplier::Preserving`
[7ee1f3c5][68d79e70]
+ `QuantHash`es now properly report `.of` and `.keyof` [8b93ec9f]
+ Added type constraints to port numbers in `IO::Socket::Async` [547f28ba]
+ Fixed re-initialization on some types of arrays [f1fa5adf]
[7262b4e8][49f07abe]
+ Gave 6.d correct `is rw` Proxy semantics [7d37f9aa]
+ Fixed `Match.^roles` [becbdeb9]
+ Fixed missing path volume after `..` is resolved [8854bbd3]
+ The `.values` method can now be used to change values in
object hashes [a728bb2d]
+ Fixed shaped dynamic variables like `my %*a{Int}` [bcdf87a6]
+ Made `my @a is Blob / Buf = ...` work [762c708f]
+ Object hashes and `QuantHash`es can now be used with
metaops [Hyper refactor]
+ Many improvements to the JS backend [32b7c089][f35dd301][9457f7e5]
[ea69c0a0][0e4969fe][9df074ba][78389aa2][1ef62aca][f460ad1a][cbbe16ed]
+ Improved error message when using placeholders with methods [deae5bcd]
[0896c301][48093d0d][0bda7dc1][90103f6d][68b44e33][8549c4c1]
+ Various improvements to produced messages [15c16e35][e6758492]
+ Additions:
+ Implemented `X::Language::TooLate` [3365094f]
+ `$*COLLATION.set` is no longer experimental [20c41ca5]
+ Added dynamic variable `$*FOLDING` [cec1f511]
+ Removals:
+ Removed unspecced `.allowed` attribute in `Pod::Block::Code` [5aba3e96]
+ Set operators `(<+)`, `≼`, `(>+)`, `` now die when used [951303f9]
[7a1a1868][81474bf9][5598f37d]
+ `Associative >>op<< Iterable` now dies, as the results are indeterminate
due to random hash key order [Hyper refactor]
+ Build system:
+ Fixed `t/*/*.t` rule in generated Makefile [d2c7e327]
+ Made running timing based tests optional [72b896c8]
+ Efficiency:
+ Made `Int eqv Int` 3x and `int eqv int` 5x as fast [fb9a0454][94dd0a41]
+ Made `ObjAt` `eqv` `ObjAt` also faster [5120d3d2]
+ Made `Hash`/`Map` slices about 5x as fast [6fe27894][b83179f0]
[c4da4c7e][9a2c4b44]
+ Optimized various operations on `Date` and `DateTime` making
them up to 3x as fast [11cb4fac][b6292fe9][08fac045][98d07cf6]
[b463746d][bf3eb8ec][a11d599f]
+ Made metaops use the fast path for `&[+=]`-like ops [e7ce194a]
+ Hyper operator refactor makes many things like
`%h >>+>> 1` 1.3x to 8x as fast [bfe2ad63][130cc817][0bc72e05]
[75c9456a][ec2848c4][f06e8582][73eb297f][194daab7][a575effe]
[c50cf82a][1a2b39dc][307a98bd][843118ea][6208c266][9221c08d]
[c03e71d5][78f64203][63ae9dcc][fa5215b6][d5a751d9][674a0837]
[8fa72681][80edefcf][cf5c8a09][534d8f65][7fad12b0][800d8fbb]
[c3f03e67][1ed2b098][21434dda][234e298b][e8285c01][32ab0d30]
[90ac0940][f7007ac0][dc67ee75][cae9847e][481dbf92][c4445649]
[19f0c842][86ce4f4e][50f2207b][2e5be5b8][1b7253df][64a47d87]
[005261a4][10693d16]
+ Internal:
+ Changed CORE.d setting compilation to propagate indicator flags [4a6d9108]
+ Made sure we don't add object to serialization context more
than once [3995e423]
+ New QAST to mbc compiler [edc4c054][6aafe18d][f8be2fa0][656a8045][bb43acdb]
+ Added `Hash.STORE(\keys,\values)` [faa19ab9]
+ Introduced `R:I.AssociativeIterableKeys` [6fe27894]
+ Various internal optimizations [5f1a81e0][1766435a][8e858c8d][00eb7b85]
[0fa6988c][bf3575cc][18ded174]
The following people contributed to this release:
Stefan Seifert, Elizabeth Mattijsen, Zoffix Znet,
Aleks-Daniel Jakimenko-Aleksejev, Paweł Murias, Timo Paulssen, Nick Logan,
Tom Browder, Rob Hoelz, Jonathan Worthington, Joelle Maslak, Donald Hunter,
Bart Wiegmans, Daniel Green, Fernando Correa de Oliveira,
Juan Julián Merelo Guervós, Samantha McVey
If you would like to contribute or find out more information, visit
<https://perl6.org>, <https://rakudo.org/how-to-help>, ask on the
<perl6-compiler@perl.org> mailing list, or ask on IRC #perl6 on freenode.
Additionally, we invite you to make a donation to The Perl Foundation
to sponsor Perl 6 development: <https://donate.perlfoundation.org/>
(put “Perl 6 Core Development Fund” in the ‘Purpose’ text field)
The next release of Rakudo (#129), is tentatively scheduled for 2018-12-15.
A list of the other planned release dates is available in the
“docs/release_guide.pod” file.
The development team appreciates feedback! If you’re using Rakudo, do
get back to us. Questions, comments, suggestions for improvements, cool
discoveries, incredible hacks, or any other feedback – get in touch with
us through (the above-mentioned) mailing list or IRC channel. Enjoy!
Please note that recent releases have known issues running on the JVM.
We are working to get the JVM backend working again but do not yet have
an estimated delivery date.
[^1]: See <http://moarvm.org/>
[^2]: What’s the difference between the Rakudo compiler and the Rakudo
Star distribution?
The Rakudo compiler is a compiler for the Perl 6 language.
Not much more.
The Rakudo Star distribution is the Rakudo compiler plus a selection
of useful Perl 6 modules, a module installer, Perl 6 introductory
documentation, and other software that can be used with the Rakudo
compiler to enhance its utility.
This diff is collapsed.
......@@ -18,8 +18,7 @@ Note that we are trying very hard to ensure there are no backward
compatibility issues post Christmas. As such, we may end up delaying
some releases to ensure any compatibility issues are resolved.
2018-11-17 Rakudo #128 (AlexDaniel + Releasable)
2018-12-15 Rakudo #129
2018-12-15 Rakudo #129 (AlexDaniel + Releasable)
(More planned dates can be generated with F<tools/release-dates.p6>).
......@@ -495,6 +494,7 @@ Previous releases were bundled as part of monthly Parrot releases.
2018-09-02 Rakudo #125 "2018.08" (AlexDaniel + Releasable)
2018-09-23 Rakudo #126 "2018.09" (AlexDaniel + Releasable)
2018-10-28 Rakudo #127 "2018.10" (AlexDaniel + Releasable)
2018-11-29 Rakudo #128 "2018.11" (AlexDaniel + Releasable) # v6.d
=head1 COPYRIGHT
......
......@@ -12,18 +12,21 @@ if %*ENV<POD_TO_TEXT_ANSI> {
sub pod2text($pod) is export {
given $pod {
when Pod::Heading { heading2text($pod) }
when Pod::Block::Code { code2text($pod) }
when Pod::Block::Named { named2text($pod) }
when Pod::Block::Para { twrap( $pod.contents.map({pod2text($_)}).join("") ) }
when Pod::Block::Table { table2text($pod) }
when Pod::Block::Declarator { declarator2text($pod) }
when Pod::Item { item2text($pod).indent(2) }
when Pod::FormattingCode { formatting2text($pod) }
when Positional { .flat».&pod2text.grep(?*).join: "\n\n" }
when Pod::Block::Comment { '' }
when Pod::Config { '' }
default { $pod.Str }
when Pod::Heading { heading2text($pod) }
when Pod::Block::Code { code2text($pod) }
when Pod::Block::Named { named2text($pod) }
when Pod::Block::Para { twrap( $pod.contents.map({pod2text($_)}).join("") ) }
when Pod::Block::Table { table2text($pod) }
when Pod::Block::Declarator { declarator2text($pod) }
when Pod::Item { item2text($pod).indent(2) }
when Pod::Defn { pod2text($pod.contents[0]) ~ "\n"
~ pod2text($pod.contents[1..*-1]) }
when Pod::FormattingCode { formatting2text($pod) }
when Positional { .flat».&pod2text.grep(?*).join: "\n\n" }
when Pod::Block::Comment { '' }
when Pod::Config { '' }
default { $pod.Str }
}
}
......@@ -47,8 +50,6 @@ sub named2text($pod) {
given $pod.name {
when 'pod' { pod2text($pod.contents) }
when 'para' { para2text($pod.contents[0]) }
when 'defn' { pod2text($pod.contents[0]) ~ "\n"
~ pod2text($pod.contents[1..*-1]) }
when 'config' { }
when 'nested' { }
default { $pod.name ~ "\n" ~ pod2text($pod.contents) }
......
......@@ -193,7 +193,12 @@ package EXPORT::pack {
}
package EXPORT::collation {
OUR::<EXPERIMENTAL-COLLATION> := True;
# this is no longer experimental, but keep the package to prevent
# code that caters to this and earlier versions of compilers from
# breaking
#
# XXX TODO: should be fine to remove on 2019-12. There is also a test
# in t/02-rakudo/99-misc.t that will need to be removed too at the time
}
# vim: ft=perl6 expandtab sw=4
This diff is collapsed.
......@@ -4,6 +4,7 @@ use Perl6::Optimizer;
class Perl6::Compiler is HLL::Compiler {
has $!language_version;
has $!can_language_versions;
method compilation-id() {
my class IDHolder { }
......@@ -24,9 +25,14 @@ class Perl6::Compiler is HLL::Compiler {
$!language_version
}
else {
$!language_version := self.config<language_version>
$!language_version := self.config<language-version>
}
}
method can_language_versions() {
$!can_language_versions
?? $!can_language_versions
!! ($!can_language_versions := self.config<can-language-versions>)
}
method command_eval(*@args, *%options) {
if nqp::existskey(%options, 'doc') && !%options<doc> {
......
This diff is collapsed.
......@@ -79,9 +79,15 @@ role Perl6::Metamodel::BUILDPLAN {
# in Mu, we produce ops here per attribute that may
# need initializing.
for @attrs {
my int $primspec := nqp::objprimspec($_.type);
#?if js
my int $is_oversized_int := $primspec == 4 || $primspec == 5;
$primspec := $is_oversized_int ?? 0 !! $primspec;
#?endif
if $_.has_accessor {
nqp::push(@plan,[
nqp::add_i(0,nqp::objprimspec($_.type)),
0 + $primspec,
$obj,
$_.name,
nqp::substr($_.name, 2)
......@@ -102,9 +108,14 @@ role Perl6::Metamodel::BUILDPLAN {
for @attrs {
if nqp::can($_, 'build') {
my $default := $_.build;
my int $primspec := nqp::objprimspec($_.type);
#?if js
my int $is_oversized_int := $primspec == 4 || $primspec == 5;
$primspec := $is_oversized_int ?? 0 !! $primspec;
#?endif
if nqp::isconcrete($default) {
nqp::push(@plan,[
nqp::add_i(4,nqp::objprimspec($_.type)),
4 + $primspec,
$obj,
$_.name,
$default
......
......@@ -210,6 +210,8 @@ class Perl6::ModuleLoader does Perl6::ModuleLoaderVMConfig {
my $setting;
if $setting_name ne 'NULL' {
# XXX TODO: see https://github.com/rakudo/rakudo/issues/2432
$setting_name := 'CORE' if $setting_name eq 'NULL.d';
# Unless we already did so, locate and load the setting.
unless nqp::defined(%settings_loaded{$setting_name}) {
DEBUG("Loading settings $setting_name") if $DEBUG;
......
......@@ -1347,7 +1347,7 @@ class Perl6::Optimizer {
}
# May be able to eliminate some decontrv operations.
if $optype eq 'p6decontrv' {
if $optype eq 'p6decontrv' || $optype eq 'p6decontrv_6c' {
# If it's rw, don't need to decont at all.
my $value := $op[1];
return $value if $op[0].value.rw;
......@@ -1777,6 +1777,7 @@ class Perl6::Optimizer {
my int $survived := 0;
my $ret_value;
try {
my $*FOLDING := 1;
$ret_value := $obj(|@args);
$survived := 1 ;
CONTROL {
......@@ -1785,7 +1786,7 @@ class Perl6::Optimizer {
}
if $survived && self.constant_foldable_type($ret_value) {
return $NULL if $!void_context && !$!in_declaration;
$*W.add_object($ret_value);
$*W.add_object_if_no_sc($ret_value);
my $wval := QAST::WVal.new(:value($ret_value));
if $op.named {
$wval.named($op.named);
......@@ -2016,7 +2017,9 @@ class Perl6::Optimizer {
)
}
my @native_assign_ops := ['', 'assign_i', 'assign_n', 'assign_s'];
# The _i64 and _u64 are only used on backends that emulate int64/uint64
my @native_assign_ops := ['', 'assign_i', 'assign_n', 'assign_s', 'assign_i64', 'assign_u64'];
method optimize_nameless_call($op) {
return NQPMu
unless nqp::elems($op)
......@@ -2171,7 +2174,7 @@ class Perl6::Optimizer {
my $meth := $pkg.HOW.find_private_method($pkg, $name);
if nqp::defined($meth) && $meth {
if nqp::isnull(nqp::getobjsc($meth)) {
try $*W.add_object($meth);
try $*W.add_object_if_no_sc($meth);
}
unless nqp::isnull(nqp::getobjsc($meth)) {
my $call := QAST::WVal.new( :value($meth) );
......
This diff is collapsed.
......@@ -7,3 +7,20 @@ proto sub undefine(Mu, *%) is raw {
multi sub undefine(Mu \x) is raw { x = Nil }
multi sub undefine(Array \x) is raw { x = Empty }
multi sub undefine(Hash \x) is raw { x = Empty }
sub infix:<<(<+)>> (|) {
die "(<+) was removed in v6.d, please use (<=) operator instead
or compile your code with 'use v6.c'"
}
sub infix:<≼>(|) {
die "≼ was removed in v6.d, please use ⊆ operator instead
or compile your code with 'use v6.c'"
}
sub infix:<<(>+)>> (|) {
die "(>+) was removed in v6.d, please use (>=) operator instead
or compile your code with 'use v6.c'"
}
sub infix:<≽>(|) {
die "≽ was removed in v6.d, please use ⊇ operator instead
or compile your code with 'use v6.c'"
}
......@@ -1849,7 +1849,7 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
}
proto method pairup(|) is nodal {*}
multi method pairup(Any:U:) { () }
multi method pairup(Any:U:) { ().Seq }
multi method pairup(Any:D:) {
my \iter := self.iterator;
gather {
......
......@@ -30,6 +30,15 @@ my class Bag does Baggy {
!! self.SET-SELF(Rakudo::QuantHash.ADD-PAIRS-TO-BAG(
nqp::create(Rakudo::Internals::IterationSet), $iterator))
}
multi method STORE(Bag:D: \objects, \values, :$INITIALIZE! --> Bag:D) {
self.SET-SELF(
Rakudo::QuantHash.ADD-OBJECTS-VALUES-TO-BAG(
nqp::create(Rakudo::Internals::IterationSet),
objects.iterator,
values.iterator
)
)
}
multi method DELETE-KEY(Bag:D: \k) {
X::Immutable.new(method => 'DELETE-KEY', typename => self.^name).throw;
......
......@@ -12,6 +12,15 @@ my class BagHash does Baggy {
)
)
}
multi method STORE(BagHash:D: \objects, \values --> BagHash:D) {
self.SET-SELF(
Rakudo::QuantHash.ADD-OBJECTS-VALUES-TO-BAG(
nqp::create(Rakudo::Internals::IterationSet),
objects.iterator,
values.iterator
)
)
}
multi method AT-KEY(BagHash:D: \k) is raw {
Proxy.new(
FETCH => {
......@@ -203,12 +212,10 @@ my class BagHash does Baggy {
)
}
# same as Baggy.values
method push-all($target --> IterationEnd) {
nqp::while( # doesn't sink
$!iter,
$target.push(nqp::getattr(
nqp::iterval(nqp::shift($!iter)),Pair,'$!value'))
$target.push(proxy(nqp::shift($!iter),$!hash))
)
}
}
......
......@@ -12,6 +12,8 @@ my role Baggy does QuantHash {
# Immutables aspects of Bag/Mix, need to live to Bag/Mix respectively.
#--- interface methods
method of() { UInt }
multi method ACCEPTS(Baggy:U: \other --> Bool:D) {
other.^does(self)
}
......
......@@ -66,7 +66,7 @@ my class Block { # declared in BOOTSTRAP
method WHY() {
if nqp::isnull($!why) {
nextsame
nextsame unless $*COMPILING_CORE_SETTING;
} else {
$!why.set_docee(self);
$!why
......
my class X::Assignment::RO { ... }
my class X::Buf::AsStr { ... }
my class X::Buf::Pack { ... }
my class X::Buf::Pack::NonASCII { ... }
......@@ -41,11 +42,20 @@ my role Blob[::T = uint8] does Positional[T] does Stringy is repr('VMArray') is
nqp::splice(nqp::create(self),@values,0,0)
}
multi method new(Blob: @values) {
@values.is-lazy
?? Failure.new(X::Cannot::Lazy.new(:action<new>,:what(self.^name)))
!! self!push-list("initializ",nqp::create(self),@values)
nqp::create(self).STORE(@values, :INITIALIZE)
}
multi method new(Blob: *@values) {
nqp::create(self).STORE(@values, :INITIALIZE)
}
proto method STORE(Blob:D: |) {*}
multi method STORE(Blob:D: Iterable:D \iterable, :$INITIALIZE) {
$INITIALIZE
?? iterable.is-lazy
?? X::Cannot::Lazy.new(:action<store>,:what(self.^name)).throw
!! self!push-list("initializ",self,iterable)
!! X::Assignment::RO.new(:value(self)).throw
}
multi method new(Blob: *@values) { self.new(@values) }
proto method allocate(|) {*}
multi method allocate(Blob:U: Int:D $elements) {
......@@ -527,6 +537,19 @@ my role Buf[::T = uint8] does Blob[T] is repr('VMArray') is array_type(T) {
!! nqp::bindpos_i(self,$pos,assignee)
}
multi method STORE(Buf:D: Blob:D $blob) {
nqp::splice(nqp::setelems(self,0),$blob,0,0)
}
# The "is default" is needed to prevent runtime dispatch errors
multi method STORE(Buf:D: int @values) is default {
nqp::splice(nqp::setelems(self,0),@values,0,0)
}
multi method STORE(Buf:D: Iterable:D \iterable) {
iterable.is-lazy
?? X::Cannot::Lazy.new(:action<store>,:what(self.^name)).throw
!! self!push-list("initializ",nqp::setelems(self,0),iterable);
}
multi method list(Buf:D:) {
Seq.new(class :: does Rakudo::Iterator::Blobby {
method pull-one() is raw {
......
......@@ -12,10 +12,6 @@ class Collation {
Int :$tertiary = 1,
Int :$quaternary = 1)
{
nqp::isnull(nqp::getlexcaller('EXPERIMENTAL-COLLATION')) and X::Experimental.new(
feature => 'the $*COLLATION dynamic variable',
use => 'collation'
).throw;
my int $i = 0;
$i += 1 if $primary.sign == 1;
$i += 2 if $primary.sign == -1;
......
......@@ -285,7 +285,7 @@ class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationR
}
}
my @result = $out.lines.unique;
my @result is List = $out.lines.unique;
if $status { # something wrong
self.store.unlock;
$RMD("Precompiling $path failed: $status") if $RMD;
......
......@@ -6,7 +6,7 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
has $!precomp-stores;
has $!precomp-store;
my @extensions = <pm6 pm>;
my @extensions := <pm6 pm>;
my $extensions := nqp::hash('pm6',1,'pm',1);
# global cache of files seen
......
......@@ -145,7 +145,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
self!bin-dir;
if ($version < 1) {
for $short-dir.dir -> $file {
my @ids = $file.lines.unique;
my @ids is List = $file.lines.unique;
$file.unlink;
$file.mkdir;
for @ids -> $id {
......@@ -379,7 +379,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
# Scripts using this interface could only have been installed long after the introduction of
# repo version 1, so we don't have to care about very old repos in this method.
my @dists = $lookup.dir.map({
my @dists is List = $lookup.dir.map({
my ($ver, $auth, $api, $resource-id) = $_.slurp.split("\n");
$resource-id ||= self!read-dist($_.basename)<files>{$file};
(id => $_.basename, ver => Version.new( $ver || 0 ), :$auth, :$api, :$resource-id).hash
......@@ -398,7 +398,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
my $lookup = $prefix.add('short').add(nqp::sha1($name));
if $lookup.e {
my $repo-version = self!repository-version;
my @dists = $repo-version < 1
my @dists is List = $repo-version < 1
?? $lookup.lines.unique.map({
self!read-dist($_)
})
......@@ -423,7 +423,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
my $repo-version = self!repository-version;
my $lookup = $.prefix.add('short').add(nqp::sha1($spec.short-name));
if $lookup.e {
my @dists = (
my @dists is List = (
$repo-version < 1
?? $lookup.lines.unique.map({
$_ => self!read-dist($_)
......
......@@ -10,6 +10,10 @@ class CompUnit::Repository::JavaRuntime { ... }
class CompUnit::Repository::Java { ... }
#?endif
#?if js
class CompUnit::Repository::FileSystemWithRecording { ... }
#?endif
class CompUnit::RepositoryRegistry {
my $lock = Lock.new;
my %include-spec2cur;
......@@ -247,7 +251,7 @@ class CompUnit::RepositoryRegistry {
}
method file-for-spec(Str $spec) {
my @parts = $spec.split('#', 2);
my @parts is List = $spec.split('#', 2);
if @parts.elems == 2 {
my $repo = self.repository-for-name(@parts[0]);
return $repo.source-file(@parts[1]) if $repo.can('source-file');
......@@ -260,7 +264,8 @@ class CompUnit::RepositoryRegistry {
shift @*ARGS if $auth;
shift @*ARGS if $ver;
$name //= $dist-name;
my @installations = $*REPO.repo-chain.grep(CompUnit::Repository::Installation);
my @installations is List =
$*REPO.repo-chain.grep(CompUnit::Repository::Installation);
my @binaries = @installations.map({ .script("bin/$script", :$name, :$auth, :$ver) }).grep(*.defined);
unless +@binaries {
@binaries = flat @installations.map: { .script("bin/$script", :$name) };
......@@ -336,8 +341,6 @@ class CompUnit::RepositoryRegistry {
}
}
# No need to do difficult things at startup when we can precompile this
# into the setting.
my %short-id2class = (
'file', CompUnit::Repository::FileSystem,
'inst', CompUnit::Repository::Installation,
......@@ -347,6 +350,9 @@ class CompUnit::RepositoryRegistry {
#?if jvm
'javart', CompUnit::Repository::JavaRuntime,
'java', CompUnit::Repository::Java,
#?endif
#?if js
'filerecording', CompUnit::Repository::FileSystemWithRecording,
#?endif
);
my $sid-lock := Lock.new;
......
......@@ -337,7 +337,7 @@ multi sub ords(Cool:D $s) { $s.ords }
proto sub comb($, $, $?, *%) {*}
multi sub comb(Regex $matcher, Cool $input, $limit = *) { $input.comb($matcher, $limit) }
multi sub comb(Str $matcher, Cool $input, $limit = *) { $input.comb($matcher, $limit) }
multi sub comb(Int:D $matcher, Cool $input, $limit = *) { $input.comb($matcher, $limit) }
multi sub comb(Int:D $size, Cool $input, $limit = *) { $input.comb($size, $limit) }
proto sub wordcase($, *%) is pure {*}
multi sub wordcase(Str:D $x) {$x.wordcase }
......
......@@ -30,7 +30,7 @@ my class Date does Dateish {
:got($day),
:range("1..{self!DAYS-IN-MONTH($year,$month)}")
).throw;
self === Date
nqp::eqaddr(self.WHAT,Date)
?? nqp::create(self)!SET-SELF($year,$month,$day,&formatter)
!! self.bless(:$year,:$month,:$day,:&formatter,|%_)
}
......@@ -43,7 +43,7 @@ my class Date does Dateish {
:got($day),
:range("1..{self!DAYS-IN-MONTH($year,$month)}")
).throw;
self === Date
nqp::eqaddr(self.WHAT,Date)
?? nqp::create(self)!SET-SELF($year,$month,$day,&formatter)
!! self.bless(:$year,:$month,:$day,:&formatter,|%_)
}
......@@ -62,7 +62,7 @@ my class Date does Dateish {
self.new($0,$1,$2,:&formatter,|%_)
}
multi method new(Date: Dateish $d, :&formatter, *%_) {
self === Date
nqp::eqaddr(self.WHAT,Date)
?? nqp::create(self)!SET-SELF($d.year,$d.month,$d.day,&formatter)
!! self.bless(
:year($d.year),
......@@ -77,7 +77,7 @@ my class Date does Dateish {
}
method new-from-daycount($daycount,:&formatter) {
self!ymd-from-daycount($daycount, my $year, my $month, my $day);
self === Date
nqp::eqaddr(self.WHAT,Date)
?? nqp::create(self)!SET-SELF($year,$month,$day,&formatter,$daycount)
!! self.bless(:$year,:$month,:$day,:&formatter,:$daycount)
}
......@@ -104,12 +104,21 @@ my class Date does Dateish {
}
method later(:$earlier, *%unit) {
my @pairs = %unit.pairs;
die "More than one time unit supplied" if @pairs > 1;
die "No time unit supplied" unless @pairs;
my $unit = self!VALID-UNIT(@pairs.AT-POS(0).key);
my $amount = @pairs.AT-POS(0).value.Int;
# basic sanity check
nqp::if(
nqp::eqaddr(
(my \later := (my \iterator := %unit.iterator).pull-one),
IterationEnd
),
(die "No time unit supplied"),
nqp::unless(
nqp::eqaddr(iterator.pull-one,IterationEnd),
(die "More than one time unit supplied")
)
);
my $unit := later.key;
my $amount = later.value;
$amount = -$amount if $earlier;
if nqp::atkey($valid-units,$unit) -> $multiplier {
......@@ -138,28 +147,42 @@ my class Date does Dateish {
method clone(*%_) {
my $h := nqp::getattr(%_,Map,'$!storage');
self.new(
nqp::existskey($h,'year') ?? nqp::atkey($h,'year') !! $!year,
nqp::existskey($h,'month') ?? nqp::atkey($h,'month') !! $!month,
nqp::existskey($h,'day') ?? nqp::atkey($h,'day') !! $!day,
formatter => nqp::existskey($h,'formatter')
?? nqp::atkey($h,'formatter') !! &!formatter,
nqp::ifnull(nqp::atkey($h,'year'), $!year),
nqp::ifnull(nqp::atkey($h,'month'),$!month),
nqp::ifnull(nqp::atkey($h,'day'), $!day),
formatter => nqp::ifnull(nqp::atkey($h,'formatter'),&!formatter),
)
}
method !clone-without-validating(*%_) { # A premature optimization.
my $h := nqp::getattr(%_,Map,'$!storage');
nqp::create(self)!SET-SELF(
nqp::existskey($h,'year') ?? nqp::atkey($h,'year') !! $!year,
nqp::existskey($h,'month') ?? nqp::atkey($h,'month') !! $!month,
nqp::existskey($h,'day') ?? nqp::atkey($h,'day') !! $!day,
nqp::ifnull(nqp::atkey($h,'year'), $!year),
nqp::ifnull(nqp::atkey($h,'month'),$!month),
nqp::ifnull(nqp::atkey($h,'day'), $!day),
&!formatter,
)
}
method new-from-diff(Date:D: Int:D $diff) {
nqp::isconcrete($!daycount)
?? nqp::stmts(
(my \new := nqp::clone(self)),
nqp::bindattr(new,Date,'$!day', $!day + $diff),
nqp::bindattr(new,Date,'$!daycount',$!daycount + $diff),
new
)
!! nqp::p6bindattrinvres(nqp::clone(self),Date,'$!day',$!day + $diff)
}
method succ(Date:D:) {
self.new-from-daycount(self.daycount + 1);
$!day < 28 && nqp::eqaddr(self.WHAT,Date)
?? self.new-from-diff(1)
!! self.new-from-daycount(self.daycount + 1)
}
method pred(Date:D:) {
self.new-from-daycount(self.daycount - 1);
$!day > 1 && nqp::eqaddr(self.WHAT,Date)
?? self.new-from-diff(-1)
!! self.new-from-daycount(self.daycount - 1)
}
multi method perl(Date:D:) {
......@@ -176,13 +199,19 @@ my class Date does Dateish {
}
multi sub infix:<+>(Date:D $d, Int:D $x) {
Date.new-from-daycount($d.daycount + $x)
nqp::eqaddr($d.WHAT,Date) && $d.day + $x <= 28
?? $d.new-from-diff($x)
!! Date.new-from-daycount($d.daycount + $x)
}
multi sub infix:<+>(Int:D $x, Date:D $d) {
Date.new-from-daycount($d.daycount + $x)
nqp::eqaddr($d.WHAT,Date) && $d.day + $x <= 28
?? $d.new-from-diff($x)
!! Date.new-from-daycount($d.daycount + $x)
}
multi sub infix:<->(Date:D $d, Int:D $x) {
Date.new-from-daycount($d.daycount - $x)
nqp::eqaddr($d.WHAT,Date) && $d.day - $x > 0
?? $d.new-from-diff(-$x)
!! Date.new-from-daycount($d.daycount - $x)
}
multi sub infix:<->(Date:D $a, Date:D $b) {
$a.daycount - $b.daycount;
......
......@@ -46,15 +46,16 @@ my class DateTime does Dateish {
!! X::DateTime::InvalidDeltaUnit.new(:$unit).throw
}
method !SET-SELF(\y,\mo,\d,\h,\mi,\s,\t,\f) {
$!year = y;
$!month = mo;
$!day = d;
$!hour = h;
$!minute = mi;
$!second = s;
$!timezone = t;
&!formatter = f;
method !SET-SELF(
$!year,
$!month,
$!day,
$!hour,
$!minute,
$!second,
$!timezone,
&!formatter,
) {
self
}
method !new-from-positional(DateTime:
......@@ -161,7 +162,7 @@ my class DateTime does Dateish {
my int $month = $m + 3 - 12 * ($m div 10);
my Int $year = $b * 100 + $d - 4800 + $m div 10;
my $dt = self === DateTime
my $dt = nqp::eqaddr(self.WHAT,DateTime)
?? ( %_ ?? die "Unexpected named parameter{"s" if %_ > 1} "
~ %_.keys.map({"`$_`"}).join(", ") ~ " passed. Were you "
~ "trying to use the named parameter form of .new() but "
......@@ -220,35 +221,36 @@ my class DateTime does Dateish {
}
method clone(*%_) {
my $h := nqp::getattr(%_,Map,'$!storage');
my \h := nqp::getattr(%_,Map,'$!storage');
self!new-from-positional(
nqp::existskey($h,'year') ?? nqp::atkey($h,'year') !! $!year,
nqp::existskey($h,'month') ?? nqp::atkey($h,'month') !! $!month,
nqp::existskey($h,'day') ?? nqp::atkey($h,'day') !! $!day,
nqp::existskey($h,'hour') ?? nqp::atkey($h,'hour') !! $!hour,
nqp::existskey($h,'minute') ?? nqp::atkey($h,'minute') !! $!minute,
nqp::existskey($h,'second') ?? nqp::atkey($h,'second') !! $!second,
nqp::ifnull(nqp::atkey(h,'year'), $!year),
nqp::ifnull(nqp::atkey(h,'month'), $!month),
nqp::ifnull(nqp::atkey(h,'day'), $!day),
nqp::ifnull(nqp::atkey(h,'hour'), $!hour),
nqp::ifnull(nqp::atkey(h,'minute'),$!minute),
nqp::ifnull(nqp::atkey(h,'second'),$!second),
%_,
timezone => nqp::existskey($h,'timezone')
?? nqp::atkey($h,'timezone') !! $!timezone,
formatter => nqp::existskey($h,'formatter')
?? nqp::atkey($h,'formatter') !! &!formatter,
timezone => nqp::ifnull(nqp::atkey(h,'timezone'),$!timezone),
formatter => nqp::ifnull(nqp::atkey(h,'formatter'),&!formatter),
)
}
method !clone-without-validating(*%_) { # A premature optimization.
return self.clone(|%_) unless self === DateTime;
my $h := nqp::getattr(%_,Map,'$!storage');
nqp::create(self)!SET-SELF(
nqp::existskey($h,'year') ?? nqp::atkey($h,'year') !! $!year,
nqp::existskey($h,'month') ?? nqp::atkey($h,'month') !! $!month,
nqp::existskey($h,'day') ?? nqp::atkey($h,'day') !! $!day,
nqp::existskey($h,'hour') ?? nqp::atkey($h,'hour') !! $!hour,
nqp::existskey($h,'minute') ?? nqp::atkey($h,'minute') !! $!minute,
nqp::existskey($h,'second') ?? nqp::atkey($h,'second') !! $!second,
nqp::existskey($h,'timezone')
?? nqp::atkey($h,'timezone') !! $!timezone,
&!formatter,
nqp::if(
nqp::eqaddr(self.WHAT,DateTime),
nqp::stmts(
(my \h := nqp::getattr(%_,Map,'$!storage')),
nqp::create(self)!SET-SELF(
nqp::ifnull(nqp::atkey(h,'year'), $!year),
nqp::ifnull(nqp::atkey(h,'month'), $!month),
nqp::ifnull(nqp::atkey(h,'day'), $!day),
nqp::ifnull(nqp::atkey(h,'hour'), $!hour),
nqp::ifnull(nqp::atkey(h,'minute'), $!minute),
nqp::ifnull(nqp::atkey(h,'second'), $!second),
nqp::ifnull(nqp::atkey(h,'timezone'),$!timezone),
&!formatter,
)
),
self.clone(|%_)
)
}
......@@ -278,12 +280,21 @@ my class DateTime does Dateish {
method hh-mm-ss() { sprintf "%02d:%02d:%02d", $!hour,$!minute,$!second }
method later(:$earlier, *%unit) {
my @pairs = %unit.pairs;
die "More than one time unit supplied" if @pairs > 1;
die "No time unit supplied" unless @pairs;
my $unit = self!VALID-UNIT(@pairs.AT-POS(0).key);
my $amount = @pairs.AT-POS(0).value;
# basic sanity check
nqp::if(
nqp::eqaddr(
(my \later := (my \iterator := %unit.iterator).pull-one),
IterationEnd
),
(die "No time unit supplied"),
nqp::unless(
nqp::eqaddr(iterator.pull-one,IterationEnd),
(die "More than one time unit supplied")
)
);
my $unit := later.key;
my $amount = later.value;
$amount = -$amount if $earlier;
# work on instant (tai)
......
......@@ -74,9 +74,10 @@ class Rakudo::Deprecations {
$index = $_ with $bt.next-interesting-index($index, :noproto);
}
else {
$index = $_
with $bt.next-interesting-index($index, :noproto, :setting)
for ^$up;
for ^$up -> $level {
$index = $_
with $bt.next-interesting-index($index, :noproto, :setting)
}
}
my $callsite = $bt[$index];
......
......@@ -2328,9 +2328,11 @@ my class X::TypeCheck::Splice is X::TypeCheck does X::Comp {
my class X::Assignment::RO is Exception {
has $.value = "value";
method message {
"Cannot modify an immutable {$!value.^name} ({
Rakudo::Internals.SHORT-GIST: $!value
})"
nqp::isconcrete($!value)
?? "Cannot modify an immutable {$!value.^name} ({
Rakudo::Internals.SHORT-GIST: $!value
})"
!! "Cannot modify an immutable '{$!value.^name}' type object"
}
method typename { $.value.^name }
}
......@@ -2965,6 +2967,11 @@ my class X::Language::Unsupported is Exception {
"No compiler available for Perl $.version"
}
}
my class X::Language::TooLate is Exception {
method message() {
"Too late to switch language version. Must be used as the very first statement."
}
}
my class X::Proc::Unsuccessful is Exception {
has $.proc;
......
......@@ -71,7 +71,9 @@ my class Hash { # declared in BOOTSTRAP
)
)
}
method STORE(Hash:D: \to_store) {
proto method STORE(|) {*}
multi method STORE(Hash:D: \to_store) {
my $temp := nqp::p6bindattrinvres(
nqp::clone(self), # make sure we get a possible descriptor as well
Map,
......@@ -111,6 +113,16 @@ my class Hash { # declared in BOOTSTRAP
nqp::p6bindattrinvres(self,Map,'$!storage',$storage)
}
multi method STORE(Hash:D: \keys, \values) {
my \iterkeys := keys.iterator;
my \itervalues := values.iterator;
nqp::bindattr(self,Map,'$!storage',nqp::hash);
nqp::until(
nqp::eqaddr((my \key := iterkeys.pull-one),IterationEnd),
self.STORE_AT_KEY(key,itervalues.pull-one)
);
self
}
multi method ASSIGN-KEY(Hash:D: Str:D $key, Mu \assignval) is raw {
my \storage := nqp::getattr(self,Map,'$!storage');
......@@ -619,7 +631,7 @@ my class Hash { # declared in BOOTSTRAP
method keys() { Seq.new(Keys.new(self)) }
my class Values does Rakudo::Iterator::Mappy {
method pull-one() {
method pull-one() is raw {
nqp::if(
$!iter,
nqp::getattr(nqp::iterval(nqp::shift($!iter)),
......
This diff is collapsed.
......@@ -34,7 +34,7 @@ my class HyperSeq does Iterable does Sequence {
RaceSeq.new(:$!configuration, :$!work-stage-head)
}
method is-lazy() { False }
method is-lazy(--> False) { }
multi method serial(HyperSeq:D:) { self.Seq }
......
......@@ -283,8 +283,9 @@ my class IO::Path is Cool does IO {
if nqp::iseq_s($part, $up) {
next unless $res-list;
nqp::pop_s($res-list);
$resolved = $res-list ?? $sep ~ nqp::join($sep, $res-list)
!! $empty;
$resolved = $res-list
?? nqp::concat(nqp::concat($volume, $sep), nqp::join($sep, $res-list))
!! $empty;
next;
}
......
......@@ -8,11 +8,13 @@ my class IO::Socket::Async {
has $!close-promise;
has $!close-vow;
subset Port-Number of Int where { !defined($_) or $_ ~~ ^65536 };
has Str $.peer-host;
has Int $.peer-port;
has Port-Number $.peer-port;
has Str $.socket-host;
has Int $.socket-port;
has Port-Number $.socket-port;
method new() {
die "Cannot create an asynchronous socket directly; please use\n" ~
......@@ -165,7 +167,7 @@ my class IO::Socket::Async {
$!close-vow.keep(True);
}
method connect(IO::Socket::Async:U: Str() $host, Int() $port,
method connect(IO::Socket::Async:U: Str() $host, Int() $port where Port-Number,
:$enc = 'utf-8', :$scheduler = $*SCHEDULER) {
my $p = Promise.new;
my $v = $p.vow;
......@@ -290,8 +292,8 @@ my class IO::Socket::Async {
method serial(--> True) { }
}
method listen(IO::Socket::Async:U: Str() $host, Int() $port, Int() $backlog = 128,
:$enc = 'utf-8', :$scheduler = $*SCHEDULER) {
method listen(IO::Socket::Async:U: Str() $host, Int() $port where Port-Number,
Int() $backlog = 128, :$enc = 'utf-8', :$scheduler = $*SCHEDULER) {
my $encoding = Encoding::Registry.find($enc);
Supply.new: SocketListenerTappable.new:
:$host, :$port, :$backlog, :$encoding, :$scheduler
......@@ -329,8 +331,8 @@ my class IO::Socket::Async {
await $p
}
method bind-udp(IO::Socket::Async:U: Str() $host, Int() $port, :$broadcast,
:$enc = 'utf-8', :$scheduler = $*SCHEDULER) {
method bind-udp(IO::Socket::Async:U: Str() $host, Int() $port where Port-Number,
:$broadcast, :$enc = 'utf-8', :$scheduler = $*SCHEDULER) {
my $p = Promise.new;
my $encoding = Encoding::Registry.find($enc);
nqp::asyncudp(
......@@ -355,11 +357,13 @@ my class IO::Socket::Async {
await $p
}
method print-to(IO::Socket::Async:D: Str() $host, Int() $port, Str() $str, :$scheduler = $*SCHEDULER) {
method print-to(IO::Socket::Async:D: Str() $host, Int() $port where Port-Number,
Str() $str, :$scheduler = $*SCHEDULER) {
self.write-to($host, $port, $!encoder.encode-chars($str), :$scheduler)
}
method write-to(IO::Socket::Async:D: Str() $host, Int() $port, Blob $b, :$scheduler = $*SCHEDULER) {
method write-to(IO::Socket::Async:D: Str() $host, Int() $port where Port-Number,
Blob $b, :$scheduler = $*SCHEDULER) {
my $p = Promise.new;
my $v = $p.vow;
nqp::asyncwritebytesto(
......
......@@ -294,6 +294,15 @@ multi sub infix:<*>(int $a, int $b --> int) {
nqp::mul_i($a, $b);
}
multi sub infix:<eqv>(Int:D $a, Int:D $b --> Bool:D) {
nqp::hllbool( # need to check types as enums such as Bool wind up here
nqp::eqaddr($a.WHAT,$b.WHAT) && nqp::iseq_I($a,$b)
)
}
multi sub infix:<eqv>(int $a, int $b --> Bool:D) {
nqp::hllbool(nqp::iseq_i($a,$b))
}
multi sub infix:<div>(Int:D \a, Int:D \b) {
b
?? nqp::div_I(nqp::decont(a), nqp::decont(b), Int)
......@@ -361,10 +370,10 @@ multi sub infix:<gcd>(int $a, int $b --> int) {
nqp::gcd_i($a, $b)
}
multi sub infix:<===>(Int:D \a, Int:D \b) {
multi sub infix:<===>(Int:D $a, Int:D $b) {
nqp::hllbool(
nqp::eqaddr(a.WHAT,b.WHAT)
&& nqp::iseq_I(nqp::decont(a), nqp::decont(b))
nqp::eqaddr($a.WHAT,$b.WHAT)
&& nqp::iseq_I($a, $b)
)
}
multi sub infix:<===>(int $a, int $b) {
......
......@@ -100,7 +100,7 @@ my role Iterable {
$!iterator.push-exactly($target, $n);
}
method is-lazy() { True }
method is-lazy(--> True) { }
}
method lazy() {
# Return a Seq with an iterator wrapping this Iterable, claiming to
......
......@@ -673,7 +673,7 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
)
}
multi method ACCEPTS(List:D: Iterable:U) { True }
multi method ACCEPTS(List:D: Iterable:U --> True) { }
multi method ACCEPTS(List:D: Iterable:D $topic) {
CATCH { default { return False } } # .elems on lazies throws
return True if nqp::eqaddr(self, nqp::decont($topic));
......
......@@ -16,25 +16,25 @@ my class Map does Iterable does Associative { # declared in BOOTSTRAP
nqp::join(
'|',
nqp::stmts( # cannot use native str arrays early in setting
(my $keys := nqp::list_s),
(my \keys := nqp::list_s),
(my \iter := nqp::iterator($!storage)),
nqp::while(
iter,
nqp::push_s($keys,nqp::iterkey_s(nqp::shift(iter)))
nqp::push_s(keys,nqp::iterkey_s(nqp::shift(iter)))
),
(my $sorted := Rakudo::Sorting.MERGESORT-str($keys)),
(my \sorted := Rakudo::Sorting.MERGESORT-str(keys)),
(my int $i = -1),
(my int $elems = nqp::elems($sorted)),
(my $strings := nqp::list_s),
(my int $elems = nqp::elems(sorted)),
(my \strings := nqp::list_s),
nqp::while(
nqp::islt_i(($i = nqp::add_i($i,1)),$elems),
nqp::stmts(
(my $key := nqp::atpos_s($sorted,$i)),
nqp::push_s($strings,$key),
nqp::push_s($strings,nqp::atkey($!storage,$key).perl)
(my \key := nqp::atpos_s(sorted,$i)),
nqp::push_s(strings,key),
nqp::push_s(strings,nqp::atkey($!storage,key).WHICH)
)
),
$strings
strings
)
)
)
......@@ -412,6 +412,20 @@ my class Map does Iterable does Associative { # declared in BOOTSTRAP
)
)
}
multi method STORE(Map:D: \keys, \values, :$INITIALIZE!) {
my \iterkeys := keys.iterator;
my \itervalues := values.iterator;
my \storage := $!storage := nqp::hash;
nqp::until(
nqp::eqaddr((my \key := iterkeys.pull-one),IterationEnd),
nqp::bindkey(
storage,
nqp::if(nqp::istype(key,Str),key,key.Str),
nqp::decont(itervalues.pull-one)
)
);
self
}
multi method STORE(Map:D: |) { X::Assignment::RO.new(value => self).throw }
method Capture(Map:D:) {
......
......@@ -857,7 +857,7 @@ my class Match is Capture is Cool does NQPMatchRole {
}
proto method Bool(|) {*}
multi method Bool(Match:U:) { False }
multi method Bool(Match:U: --> False) { }
multi method Bool(Match:D:) { nqp::hllbool($!pos >= $!from) }
multi method Numeric(Match:D:) {
......
......@@ -11,6 +11,15 @@ my class Mix does Mixy {
!! self.SET-SELF(Rakudo::QuantHash.ADD-PAIRS-TO-MIX(
nqp::create(Rakudo::Internals::IterationSet), $iterator))
}
multi method STORE(Mix:D: \objects, \values, :$INITIALIZE! --> Mix:D) {
self.SET-SELF(
Rakudo::QuantHash.ADD-OBJECTS-VALUES-TO-MIX(
nqp::create(Rakudo::Internals::IterationSet),
objects.iterator,
values.iterator
)
)
}
multi method DELETE-KEY(Mix:D: \k) {
X::Immutable.new(method => 'DELETE-KEY', typename => self.^name).throw;
......
......@@ -15,6 +15,15 @@ my class MixHash does Mixy {
)
)
}
multi method STORE(MixHash:D: \objects, \values --> MixHash:D) {
self.SET-SELF(
Rakudo::QuantHash.ADD-OBJECTS-VALUES-TO-MIX(
nqp::create(Rakudo::Internals::IterationSet),
objects.iterator,
values.iterator
)
)
}
multi method AT-KEY(MixHash:D: \k) is raw {
Proxy.new(
FETCH => {
......@@ -184,12 +193,10 @@ my class MixHash does Mixy {
)
}
# same as Baggy.values
method push-all($target --> IterationEnd) {
nqp::while( # doesn't sink
$!iter,
$target.push(nqp::getattr(
nqp::iterval(nqp::shift($!iter)),Pair,'$!value'))
$target.push(proxy(nqp::shift($!iter),$!hash))
)
}
}
......
my role Mixy does Baggy {
method of() { Real }
multi method hash(Mixy:D: --> Hash:D) { self!HASHIFY(Real) }
multi method Hash(Mixy:D: --> Hash:D) { self!HASHIFY(Any) }
......
......@@ -964,11 +964,11 @@ multi sub infix:<eqv>($?) { Bool::True }
multi sub infix:<eqv>(Any:U \a, Any:U \b) {
nqp::hllbool(nqp::eqaddr(nqp::decont(a),nqp::decont(b)))
}
multi sub infix:<eqv>(Any:D \a, Any:U \b) { False }
multi sub infix:<eqv>(Any:U \a, Any:D \b) { False }
multi sub infix:<eqv>(Any:D \a, Any:U \b --> False) { }
multi sub infix:<eqv>(Any:U \a, Any:D \b --> False) { }
multi sub infix:<eqv>(Any:D \a, Any:D \b) {
nqp::hllbool(
nqp::eqaddr(a,b)
nqp::eqaddr(nqp::decont(a),nqp::decont(b))
|| (nqp::eqaddr(a.WHAT,b.WHAT) && nqp::iseq_s(a.perl,b.perl))
)
}
......
class X::Assignment::RO { ... }
my class Nil is Cool { # declared in BOOTSTRAP
method new(*@ --> Nil) { }
multi method gist(Nil:) { 'Nil' }
......
......@@ -29,4 +29,11 @@ my class ObjAt { # declared in BOOTSTRAP
}
}
multi sub infix:<eqv>(ObjAt:D $a, ObjAt:D $b) {
nqp::hllbool(
nqp::eqaddr($a.WHAT,$b.WHAT)
&& nqp::iseq_s(nqp::unbox_s($a),nqp::unbox_s($b))
)
}
# vim: ft=perl6 expandtab sw=4
......@@ -8,7 +8,7 @@ my class Pod::Block {
my $leading = ' ' x $level;
my %confs;
my @chunks;
for <config name level caption type> {
for <config name level caption type term> {
my $thing = $pod.?"$_"();
if $thing {
%confs{$_} = nqp::istype($thing,Iterable)
......@@ -46,7 +46,6 @@ my class Pod::Block::Named is Pod::Block {
my class Pod::Block::Comment is Pod::Block { }
my class Pod::Block::Code is Pod::Block {
has @.allowed;
}
my class Pod::Block::Declarator is Pod::Block {
......@@ -69,11 +68,14 @@ my class Pod::Block::Declarator is Pod::Block {
method contents {
if @!leading && @!trailing {
[ $.leading ~ "\n" ~ $.trailing ]
} elsif @!leading {
}
elsif @!leading {
[ $.leading ]
} elsif @!trailing {
}
elsif @!trailing {
[ $.trailing ]
} else {
}
else {
[]
}
}
......
......@@ -97,8 +97,9 @@ my class Proc::Async {
has $!stderr_descriptor_vow;
has $!stdout_descriptor_used = Promise.new;
has $!stderr_descriptor_used = Promise.new;
has $.path;
has @.args;
has $.path; # XXX TODO deprecated on 2018-11-04
has @.args; # XXX TODO deprecated on 2018-11-04
has @.command is List;
has $.w;
has $.enc = 'utf8';
has $.translate-nl = True;
......@@ -120,8 +121,11 @@ my class Proc::Async {
proto method new(|) {*}
multi method new(*@args where .so) {
# XXX TODO .args and .path deprecated on 2018-11-04 to be
# replaced by .command https://github.com/rakudo/rakudo/issues/2444
my @command := @args.List;
my $path = @args.shift;
self.bless(:$path, :@args, |%_)
self.bless(:$path, :@args, :@command, |%_)
}
submethod TWEAK(--> Nil) {
......
......@@ -33,19 +33,20 @@ my class Promise does Awaitable {
has $!cond;
has $!thens;
has Mu $!dynamic_context;
has Bool $!report-broken-if-sunk;
submethod new(:$scheduler = $*SCHEDULER) {
submethod new(:$scheduler = $*SCHEDULER, :$report-broken-if-sunk) {
my \p = nqp::create(self);
p.BUILD(:$scheduler);
p.BUILD(:$scheduler, :$report-broken-if-sunk);
p
}
submethod BUILD(:$scheduler = $*SCHEDULER --> Nil) {
$!scheduler := $scheduler;
$!lock := nqp::create(Lock);
$!cond := $!lock.condition();
$!status := Planned;
$!thens := nqp::list();
submethod BUILD(:$!scheduler = $*SCHEDULER, :$report-broken-if-sunk --> Nil) {
$!report-broken-if-sunk := so $report-broken-if-sunk;
$!lock := nqp::create(Lock);
$!cond := $!lock.condition();
$!status := Planned;
$!thens := nqp::list();
}
# A Vow is used to enable the right to keep/break a promise
......@@ -239,8 +240,15 @@ my class Promise does Awaitable {
}
}
method start(Promise:U: &code, :&catch, :$scheduler = $*SCHEDULER, |c) {
my $p := self.new(:$scheduler);
method sink(--> Nil) {
if $!report-broken-if-sunk && $!lock.protect({ not nqp::elems($!thens) }) {
self.then({ .status == Broken && $!scheduler.handle_uncaught(.cause) });
}
}
method start(Promise:U: &code, :&catch, :$scheduler = $*SCHEDULER,
:$report-broken-if-sunk, |c) {
my $p := self.new(:$scheduler, :$report-broken-if-sunk);
nqp::bindattr($p, Promise, '$!dynamic_context', nqp::ctx());
my $vow := $p.vow;
$scheduler.cue(
......
my role QuantHash does Associative {
method keyof() { Any }
method SET-SELF(QuantHash:D: \elems) { # cannot be a private method