Commit 2135c669 authored by Dominique Dumont's avatar Dominique Dumont

New upstream version 2018.02.1

parent a876300f
......@@ -792,6 +792,11 @@ E: email@froggs.de
N: Tokuhiro Matsuno
E: tokuhirom@gmail.com
N: Tom Browder
E: tom.browder@gmail.com
U: tbrowder
S: Niceville, Florida, USA
N: Tomasz Konojacki
E: me@xenu.tk
......
......@@ -399,6 +399,7 @@ General Options:
--make-install Install Rakudo after configuration is done
--moar-option='--option=value'
Options to pass to MoarVM's Configure.pl
For example: --moar-option='--compiler=clang'
--git-protocol={ssh,https,git}
Protocol used for cloning git repos
--git-depth=<number>
......@@ -414,7 +415,9 @@ General Options:
Please note that the --gen-moar and --gen-nqp options are there for convenience
only and will actually immediately - at Configure time - compile and install
moar and nqp respectively. They will live under the path given to --prefix,
unless other targeting options are used.
unless other targeting options are used. To configure how MoarVM should be
compiled, use the --moar-option flag and view MoarVM's Configure.pl for more
information on its configuration options.
Configure.pl also reads options from 'config.default' in the current directory.
END
......
......@@ -3,7 +3,6 @@ blib/Perl6/.gitignore
Configure.pl
CONTRIBUTING.md
CREDITS
docs/2017-IO-Grant--Action-Plan.md
docs/announce/2009-02
docs/announce/2009-03
docs/announce/2009-04
......@@ -118,8 +117,12 @@ docs/announce/2017.10.md
docs/announce/2017.11.md
docs/announce/2017.12.md
docs/announce/2018.01.md
docs/announce/2018.02.1.md
docs/announce/2018.02.md
docs/architecture.html
docs/architecture.svg
docs/archive/2017-IO-Grant--Action-Plan.md
docs/archive/constants-type-constraints-proposal-2018-02-10.md
docs/ChangeLog
docs/compiler_overview.pod
docs/deprecations
......@@ -204,6 +207,7 @@ src/core/CompUnit/Repository/NQP.pm
src/core/CompUnit/Repository/Perl5.pm
src/core/CompUnit/Repository.pm
src/core/CompUnit/RepositoryRegistry.pm
src/core/CompUnit/Repository/Spec.pm
src/core/CompUnit/Repository/Unknown.pm
src/core/control.pm
src/core/Cool.pm
......@@ -540,8 +544,10 @@ t/04-nativecall/22-method.t
t/04-nativecall/CompileTestLib.pm
t/05-messages/01-errors.t
t/05-messages/02-errors.t
t/05-messages/03-errors.t
t/05-messages/10-warnings.t
t/05-messages/11-overflow.t
t/05-messages/moar/01-errors.t
t/05-messages/v6.d-tests/01-errors.t
t/06-telemetry/01-basic.t
t/06-telemetry/02-usage.t
......@@ -549,6 +555,19 @@ t/06-telemetry/03-thread.t
t/06-telemetry/04-threadpool.t
t/07-pod-to-text/01-whitespace.t
t/08-performance/01-iterators.t
t/08-performance/02-qast-rewrites.t
t/08-performance/99-misc.t
t/09-moar/00-misc.t
t/09-moar/General_Category__extracted-DerivedGeneralCategory.t
t/09-moar/General_Category__UnicodeData__2.t
t/09-moar/Line_Break__LineBreak.t
t/09-moar/NAME__UnicodeData.t
t/09-moar/UnipropCheck.pm6
t/10-qast/00-misc.t
t/3rdparty/Unicode/10.0.0/extracted/DerivedGeneralCategory.txt
t/3rdparty/Unicode/10.0.0/LineBreak.txt
t/3rdparty/Unicode/10.0.0/UnicodeData.txt
t/3rdparty/Unicode/LICENSE
t/fudgeandrun
t/harness5
t/harness6
......@@ -589,6 +608,7 @@ tools/update-passing-test-data.pl
tools/update-tai-utc.pl
tools/util/perlcritic.conf
t/packages/Test/Helpers.pm6
t/packages/Test/Helpers/QAST.pm6
t/spec/fudge
t/spec/fudgeall
t/spec/fudgeandrun
......
......@@ -42,7 +42,7 @@ any administrator privileges for carrying out this step.
To automatically download, build, and install a fresh MoarVM and NQP, run:
perl Configure.pl --gen-moar --gen-nqp --backends=moar
$ perl Configure.pl --gen-moar --gen-nqp --backends=moar
Please be aware, that this will install MoarVM and NQP into your given
--prefix before Configure.pl exits.
......@@ -50,12 +50,34 @@ Please be aware, that this will install MoarVM and NQP into your given
Alternatively, feel free to git clone https://github.com/perl6/nqp and
https://github.com/MoarVM/MoarVM manually and install them individually.
Configuration flags can be passed to MoarVM's Configure.pl using the
--moar-option flag. For example, if you wish to use Clang when GCC is the
default compiler selected for your OS, use the --compiler flag:
$ perl Configure.pl --gen-moar --moar-option='--compiler=clang' \
--gen-nqp --backends=moar
If the compiler you want to use isn't known by MoarVM or you have multiple
versions of the same compiler installed, the --cc flag can be used to pass its
exact binary:
$ perl Configure.pl --gen-moar --moar-option='--cc=egcc' \
--gen-nqp --backends=moar
Custom optimization and debugging levels may also be passed through:
$ perl Configure.pl --gen-moar --moar-option='--optimize=0 --debug=3' \
--gen-nqp --backends=moar
For more information on how MoarVM can be configured, view MoarVM's
Configure.pl.
### Configuring Rakudo to run on the JVM
Note that to run Rakudo on JVM, JDK 1.8 must be installed. To automatically
download, build, and install a fresh NQP, run:
perl Configure.pl --gen-nqp --backends=jvm
$ perl Configure.pl --gen-nqp --backends=jvm
If you get an out of memory error building rakudo on the JVM, you may
need to modify your NQP runner to limit memory use. e.g. edit the
......@@ -125,7 +147,7 @@ If you would like simple history and tab completion in the perl6 executable,
you need to install the Linenoise module. The recommended way to install
Linenoise is via [zef](https://github.com/ugexe/zef):
zef install Linenoise
$ zef install Linenoise
An alternative is to use a third-party program such as [rlwrap](http://utopia.knoware.nl/~hlub/uck/rlwrap/#rlwrap).
......
New in 2018.02.1:
+ Fixes:
+ Fixed Whatever curry QAST::Block migration in stmt mods [5270471c]
New in 2018.02:
+ Fixes:
+ Fixed `no worries` pragma [f5b4d89f]
+ Fixed IO::Socket::Async losing :$scheduler in .print-to [7c451514]
+ Fixed postconstraints in `my (...)` being ignored [3745eff1]
+ Fixed optimizer crashes in `map` with certain args [f3efe5e6]
+ Fixed IO::Handle.get on TTYs blocking after EOF [359efef7][af4dfe82]
+ Fixed crash with colonpaired variable declaration [a35cd4e6]
+ Fixed crashes in degenerate .tail(Callable) [ba675971]
+ Fixed crash in `temp`/`let` with parameterized hashes [0a32e51b]
+ Fixed Hash.clone and Array.clone losing descriptor [0d7c4fe8][45560ac9]
+ Fixed `let`/`temp` on hashes losing Nils [8c4c979e]
+ Fixed crash in Any.skip(Callable) [8efba3a8]
+ Fixed crashes with native types in conditionals [d1a48efc]
+ Fixed many issues with block migration in thunk gen [1ee89b54][31ab8683]
+ Fixed "No such method 'prefix'" when there's no HOME directory [b6a7d7f6]
+ Fixed buf8 punning happening at INIT time instead of BEGIN [c6cc673d]
+ Fixed type constraint in Str.split's Seq [8afd791c]
+ Fixed Iterator.Rotor when cycle contains Whatever or Inf [ba7b4571]
+ Fixed crash with ENTER nested inside LEAVE [58de239c]
+ Fixed wrong error in REPL with none Junctions [2c36ab2e]
+ Fixed semantics of :b quoter tweak [deffe54b]
+ Fixed error when throwing error during setting compilation [c820e4be]
+ Fixed crashes with compile time evaluation of Whatever curry [7c1f0b41]
+ Fixed crash in Proxy.perl [902f45f5]
+ Fixed encoding of ›˜œžŸ™š with windows-1252 (Latin) encoding [4507a565]
+ Fixed state vars in `do`-ed loops [299e8526]
+ Fixed whatever curry with regexes [d80fc376]
+ Fixed crashes with compile time evaluation of `where` thunks [95f23a56]
+ Fixed broken 2-arity sort of 2-el list [2e65de29]
+ Fixed postfix whatever curry with another curry inside [e8c6c259]
+ Fixed empty compiler version when the git repo has no tags [382024e6]
+ Fixed migration of in-regex blocks [c0c7756f]
+ Fixed missing decont in `cmp` [114e3735][25c5c488]
+ Fixed drift when reusing lazy iterables for indexing [f330d7fc]
+ Fixed crash in parameterized constraints on attrs with .= [562edfc5]
+ Fixed REPL adding empty lines to the history file [24fab707]
+ Fixed Parameter.usage-name to omit leading * and ! [3c73099c]
+ Fixed Any.tail(Callable) violating Iterator protocol [2cc7b631]
+ Fixed .perl of handled Failures [b2a21fa9]
+ Unified List.roll/pick invocant specification [311ef07f]
+ Fixed multi-threaded precompilation [ac87ea2a]
+ Fixed issues in constant type declarations [f559c6d8]
+ Fixed `if` with slurpies on its block [ef1d22f4][dfb6d951][59556c70]
[4b7113fa][00af9ce2]
+ Improved SprintfHandler [d419afe4][4ac67e73][684b99ea][13406517]
+ Fixed unwanted curries with HyperWhatever type object [57a1aa7a]
+ Made Backtrace.gist more helpful [555db42a]
+ Fixed ($ = 42) vs ($ = "42").subst-mutate [e7af9a6a]
+ Fixed Cool.subst-mutate to only mutate if there's a match [61015526]
+ Made Str.subst-mutate always return a List on :g [77794a28]
+ Made Str.match(:x) consistently return a non-Slip List [829ea8e3]
+ Fixed return of multi-match options of Str.subst-mutate [e0d39321]
+ Fixed .Numeric/.Real on :U numerics and .Real on :D allomorphs [1dc1f038]
+ Various fixes for the JVM backend [a2499c90][1f223190][f2188e45]
+ Various improvements to produced messages [8ffbc43b][7f07f68f][34b3356f]
[de2d8296][1c894e41][d419afe4]
+ Additions:
+ Added windows-1251 (Cyrillic) encoding to the list of possible encodings
[c73cb78f][4507a565]
+ Added support for .= to init sigilless vars [8ba3c86e]
+ Added compile time LiteralType error for native vars [e930e253]
[63a1d25a][30b82b98]
+ Efficiency:
+ Made `$ where Type1|Type2|Type…` typecheck ~8x faster [43b9c829][264a1a27]
+ Many compunit speedups [5bd33669][6fa1e78f][c268f55c][5be174bb]
[b188cc82][838beab9][a9a9e1c9][00cde175][ed9b287c]
+ Made certain conditionals with natives 2.1x faster [d1a48efc]
+ Improved dynamic optimization of nativecast [3ed2fbd5]
+ Reduced startup overhead of file I/O and module loading [db1e067e]
+ Made `dispatch:<var>` call up to 43x faster [ff31f0a3]
+ Shaved off 10ms when loading a native library [86e926c7]
+ Made compilation up to 6% faster (for 3000-line files) [f4732164]
+ Made Whatever currier up to 2.2x faster [752bb8b3]
+ Made list assignment with roll up to 20% faster [65d6fe48]
+ Moved `$*PERL` initialization to BEGIN time to save runtime [bdb4d34d]
+ Made Version.new 82x faster [02d2e2ca]
+ Added native `num` post-inc/dec to pre- optimization [4a5cc2c2][13e6ed8c]
[888328ef][971d17c4]
+ Made `.=` up to 63x faster [abea3242][01237782][2ba7634c]
New in 2018.01:
+ Fixes:
+ Fixed IO::CatHandle.read switching handles too soon [dc800d89]
......
# Announce: Rakudo Perl 6 compiler, Release 2018.02.1
On behalf of the Rakudo development team, I'm announcing an
out-of-schedule release of the Rakudo Perl 6 compiler.
Rakudo is an implementation of Perl 6 on the Moar Virtual Machine[^1].
This release is a point release in addition to the regular, monthly
releases. Rakudo 2018.02 (note: no .1) was discovered to contain a bug
which caused segfaults when using Whatever curries in topics of
for/given statement modifiers.
The tarball for this release is available from <http://rakudo.org/downloads/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
<http://rakudo.org/downloads/star/>.
The changes in this release are outlined below:
New in 2018.02.1:
+ Fixes:
+ Fixed Whatever curry QAST::Block migration in stmt mods [5270471c]
The following people contributed to this release:
Zoffix Znet, Aleks-Daniel Jakimenko-Aleksejev
If you would like to contribute or find out more information, visit
<http://perl6.org>, <http://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 (#121), is tentatively scheduled for 2018-03-17.
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.
# Announce: Rakudo Perl 6 compiler, Release #120 (2018.02)
On behalf of the Rakudo development team, I’m very happy to announce the
February 2018 release of Rakudo Perl 6 #120. Rakudo is an implementation of
Perl 6 on the Moar Virtual Machine[^1].
This release implements the 6.c version of the Perl 6 specifications.
It includes bugfixes and optimizations on top of
the 2015.12 release of Rakudo.
Upcoming releases in 2018 will include new functionality that is not
part of the 6.c specification, available with a lexically scoped
pragma. Our goal is to ensure that anything that is tested as part of the
6.c specification will continue to work unchanged. There may be incremental
spec releases this year as well.
The tarball for this release is available from <http://rakudo.org/downloads/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
<http://rakudo.org/downloads/star/>.
The changes in this release are outlined below:
New in 2018.02:
+ Fixes:
+ Fixed `no worries` pragma [f5b4d89f]
+ Fixed IO::Socket::Async losing :$scheduler in .print-to [7c451514]
+ Fixed postconstraints in `my (...)` being ignored [3745eff1]
+ Fixed optimizer crashes in `map` with certain args [f3efe5e6]
+ Fixed IO::Handle.get on TTYs blocking after EOF [359efef7][af4dfe82]
+ Fixed crash with colonpaired variable declaration [a35cd4e6]
+ Fixed crashes in degenerate .tail(Callable) [ba675971]
+ Fixed crash in `temp`/`let` with parameterized hashes [0a32e51b]
+ Fixed Hash.clone and Array.clone losing descriptor [0d7c4fe8][45560ac9]
+ Fixed `let`/`temp` on hashes losing Nils [8c4c979e]
+ Fixed crash in Any.skip(Callable) [8efba3a8]
+ Fixed crashes with native types in conditionals [d1a48efc]
+ Fixed many issues with block migration in thunk gen [1ee89b54][31ab8683]
+ Fixed "No such method 'prefix'" when there's no HOME directory [b6a7d7f6]
+ Fixed buf8 punning happening at INIT time instead of BEGIN [c6cc673d]
+ Fixed type constraint in Str.split's Seq [8afd791c]
+ Fixed Iterator.Rotor when cycle contains Whatever or Inf [ba7b4571]
+ Fixed crash with ENTER nested inside LEAVE [58de239c]
+ Fixed wrong error in REPL with none Junctions [2c36ab2e]
+ Fixed semantics of :b quoter tweak [deffe54b]
+ Fixed error when throwing error during setting compilation [c820e4be]
+ Fixed crashes with compile time evaluation of Whatever curry [7c1f0b41]
+ Fixed crash in Proxy.perl [902f45f5]
+ Fixed encoding of ›˜œžŸ™š with windows-1252 (Latin) encoding [4507a565]
+ Fixed state vars in `do`-ed loops [299e8526]
+ Fixed whatever curry with regexes [d80fc376]
+ Fixed crashes with compile time evaluation of `where` thunks [95f23a56]
+ Fixed broken 2-arity sort of 2-el list [2e65de29]
+ Fixed postfix whatever curry with another curry inside [e8c6c259]
+ Fixed empty compiler version when the git repo has no tags [382024e6]
+ Fixed migration of in-regex blocks [c0c7756f]
+ Fixed missing decont in `cmp` [114e3735][25c5c488]
+ Fixed drift when reusing lazy iterables for indexing [f330d7fc]
+ Fixed crash in parameterized constraints on attrs with .= [562edfc5]
+ Fixed REPL adding empty lines to the history file [24fab707]
+ Fixed Parameter.usage-name to omit leading * and ! [3c73099c]
+ Fixed Any.tail(Callable) violating Iterator protocol [2cc7b631]
+ Fixed .perl of handled Failures [b2a21fa9]
+ Unified List.roll/pick invocant specification [311ef07f]
+ Fixed multi-threaded precompilation [ac87ea2a]
+ Fixed issues in constant type declarations [f559c6d8]
+ Fixed `if` with slurpies on its block [ef1d22f4][dfb6d951][59556c70]
[4b7113fa][00af9ce2]
+ Improved SprintfHandler [d419afe4][4ac67e73][684b99ea][13406517]
+ Fixed unwanted curries with HyperWhatever type object [57a1aa7a]
+ Made Backtrace.gist more helpful [555db42a]
+ Fixed ($ = 42) vs ($ = "42").subst-mutate [e7af9a6a]
+ Fixed Cool.subst-mutate to only mutate if there's a match [61015526]
+ Made Str.subst-mutate always return a List on :g [77794a28]
+ Made Str.match(:x) consistently return a non-Slip List [829ea8e3]
+ Fixed return of multi-match options of Str.subst-mutate [e0d39321]
+ Fixed .Numeric/.Real on :U numerics and .Real on :D allomorphs [1dc1f038]
+ Various fixes for the JVM backend [a2499c90][1f223190][f2188e45]
+ Various improvements to produced messages [8ffbc43b][7f07f68f][34b3356f]
[de2d8296][1c894e41][d419afe4]
+ Additions:
+ Added windows-1251 (Cyrillic) encoding to the list of possible encodings
[c73cb78f][4507a565]
+ Added support for .= to init sigilless vars [8ba3c86e]
+ Added compile time LiteralType error for native vars [e930e253]
[63a1d25a][30b82b98]
+ Efficiency:
+ Made `$ where Type1|Type2|Type…` typecheck ~8x faster [43b9c829][264a1a27]
+ Many compunit speedups [5bd33669][6fa1e78f][c268f55c][5be174bb]
[b188cc82][838beab9][a9a9e1c9][00cde175][ed9b287c]
+ Made certain conditionals with natives 2.1x faster [d1a48efc]
+ Improved dynamic optimization of nativecast [3ed2fbd5]
+ Reduced startup overhead of file I/O and module loading [db1e067e]
+ Made `dispatch:<var>` call up to 43x faster [ff31f0a3]
+ Shaved off 10ms when loading a native library [86e926c7]
+ Made compilation up to 6% faster (for 3000-line files) [f4732164]
+ Made Whatever currier up to 2.2x faster [752bb8b3]
+ Made list assignment with roll up to 20% faster [65d6fe48]
+ Moved `$*PERL` initialization to BEGIN time to save runtime [bdb4d34d]
+ Made Version.new 82x faster [02d2e2ca]
+ Added native `num` post-inc/dec to pre- optimization [4a5cc2c2][13e6ed8c]
[888328ef][971d17c4]
+ Made `.=` up to 63x faster [abea3242][01237782][2ba7634c]
The following people contributed to this release:
Zoffix Znet, JJ Merelo, Pawel Murias, Aleks-Daniel Jakimenko-Aleksejev,
Stefan Seifert, Luca Ferrari, Will "Coke" Coleda, Tom Browder,
Samantha McVey, Elizabeth Mattijsen, Christian Bartolomäus, Jeremy Studer,
Curt Tilmes, Jan-Olof Hendig, Timo Paulssen, Itsuki Toyota, Pepe Schwarz,
Jonathan Worthington, Moritz Lenz, Tobias Boege, Wenzel P. P. Peppmeyer,
Fernando Correa de Oliveira, Nick Logan, Andrew Shitov, Jonas Kramer,
Alberto Luaces, Ben Davies, 0racle
If you would like to contribute or find out more information, visit
<http://perl6.org>, <http://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 (#121), is tentatively scheduled for 2018-03-17.
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.
# Type Constraints on Constants
*Feb. 10, 2018 proposal by Zoffix*
# TABLE OF CONTENTS
- [Type Constraints on Constants](#type-constraints-on-constants)
- [General Spec of Behaviour](#general-spec-of-behaviour)
- [Examples of behaviour](#examples-of-behaviour)
- [Sigilless/`$`-sigiled constants](#sigilless-sigiled-constants)
- [Behaviour with `@`-, `%`-, and `&amp;`-sigiled constants](#behaviour-with-----and--sigiled-constants)
- [`@`-sigiled constants](#-sigiled-constants)
- [`%`-sigiled constants](#-sigiled-constants-1)
- [`&amp;`-sigiled constants](#-sigiled-constants-2)
- [Deviations from Current Behaviour](#deviations-from-current-behaviour)
## General Spec of Behaviour
* Constants bind initializer to them
* Constants with `@` sigil
* Typecheck initializer for `Positional`
* When `.=` op is used, method is called on `List` type object
* If initializer isn't positional, call `.cache` on it
* Constants with `%` sigil
* Typecheck initializer for `Associative`
* When `.=` op is used, method is called on `Map` type object
* If initializer isn't associative, call `.Map` on it
* Constants with `&` sigil
* Typecheck initializer for `Callable`
* When `.=` op is used, method is called on `Callable` type object
* If it isn't callable, throw
* Default type of constants is `Mu`
* Only `is export` trait is supported
* `where` constraints are not supported
## Examples of behaviour
*Note: the `.new()` calls shown in comments simply describe what the resultant
object will be, NOT that any `.new()` calls will actually be made.*
## Sigilless/`$`-sigiled constants
`foo` and `\foo` are equivalent. `$foo` is equivalent in behaviour, except that
it defines a symbol with a `$` sigil.
```perl6
constant foo .= new; # Mu.new
constant foo = 42; # Int.new(42)
my Int constant foo = 42; # Int.new(42)
my Int constant foo .=new: 42; # Int.new(42)
```
```perl6
my Array[Numeric] constant foo .= new: 1, 2, 3; # Array[Numeric].new(1, 2, 3)
foo.push: 42; # it's an Array, so this works
```
## Behaviour with `@`-, `%`-, and `&`-sigiled constants
Some cases don't have a clear and obvious meaning, as `constant @foo .=new: 1,
2, 3` makes a `List`, yet `my Numeric constant @foo .=new: 1, 2, 3` would have
to make an `Array`, because `List` cannot be parametarized.
So for them, I propose throwing a `X::ParametricConstant` exception, defined
something like:
```perl6
my class X::ParametricConstant is Exception {
has $.sigil;
method message() {
"Parametarization of {$!sigil}-sigiled constants is not supported.\n"
# ~ "some helpful explanation of the alternative declarations"
}
}
```
### `@`-sigiled constants
```perl6
constant @foo = 1, 2, 3; # List.new(1, 2, 3)
constant @foo .=new: 1, 2, 3; # List.new(1, 2, 3)
constant @foo = [1, 2, 3]; # Array.new(1, 2, 3)
constant @foo .=new: [1, 2, 3]; # List.new(1, 2, 3)
constant @foo = Array[Numeric].new: 1, 2, 3; # Array[Numeric].new(1, 2, 3)
my Numeric constant @foo = 1, 2, 3; # throw X::ParametricConstant
my Numeric constant @foo .=new: 1, 2, 3; # throw X::ParametricConstant
my $foo := class Foo {}.new;
constant @foo = $foo; # List.new(Foo.new)
constant @foo = $foo,; # List.new(Foo.new)
constant @foo = $foo, $foo; # List.new(Foo.new, Foo.new)
class Bar does Positional {}.new;
BEGIN my $bar-scalar = Bar.new;
constant @foo = Bar.new; # Bar.new
constant @foo = $bar-scalar; # Bar.new
constant @foo = Bar.new,; # List.new(Bar.new)
constant @foo = Bar.new, Bar.new; # List.new(Bar.new, Bar.new)
```
### `%`-sigiled constants
```perl6
constant %foo = 1, 2, 3; # throw X::Hash::Store::OddNumber
constant %foo = 1, 2, 3, 4; # Map.new((1 => 2, 3 => 4))
constant %foo = [1, 2, 3, 4]; # Map.new((1 => 2, 3 => 4))
constant %foo .=new: 1, 2, 3, 4; # Map.new((1 => 2, 3 => 4))
constant %foo = :42foo; # Pair.new(:key<foo>, :value(42))
constant %foo = :42foo, :70bar; # Map.new((:42foo, :70bar))
constant %foo = %(:42foo, :70bar); # Hash.new((:42foo, :70bar))
constant %foo .=new: :42foo; # Map.new((:42foo))
constant %foo .=new: :42foo, :70bar; # Map.new((:42foo, :70bar))
constant %foo .=new: %(:42foo, :70bar); # Map.new((:42foo, :70bar))
constant %foo = Hash[Numeric].new: 1, 2; # Hash[Numeric].new(1, 2)
my Numeric constant %foo = 1, 2; # throw X::ParametricConstant
my Numeric constant %foo .=new: 1, 2; # throw X::ParametricConstant
class Foo {}.new;
constant %foo = Foo.new; # throw X::Hash::Store::OddNumber
constant %foo = Foo.new,; # throw X::Hash::Store::OddNumber
constant %foo = Foo.new, Foo.new; # Map.new(Foo.new, Foo.new)
class Bar does Associative {}.new;
BEGIN my $bar-scalar = Bar.new;
constant %foo = $bar; # Bar.new
constant %foo = $bar-scalar; # Bar.new
constant %foo = $bar,; # throw X::Hash::Store::OddNumber
constant %foo = $bar, $bar; # Map.new(Bar.new, Bar.new)
```
### `&`-sigiled constants
Throwing `X::ParametricConstant` on these sigils makes less sense, but I propose
we throw it anyway for consistency.
```perl6
my Numeric constant &foo = -> --> Numeric {}; # throw X::ParametricConstant
my Numeric constant &foo .=new; # throw X::ParametricConstant
constant &foo = &say; # binds &say to &foo
```
## Deviations from Current Behaviour
I'm dubious there are any spec tests actually covering it, but if there are,
then the proposal is to implement the behaviour in 6.d language, instead.
```perl6
# (no spectests for this and it's already changed on master)
constant foo .= new; # OLD: Any.new
# NEW: Mu.new
```
```perl6
constant %foo = :42foo, :70bar; # CURRENT: throws typecheck failure
# PROPOSED: Map.new((:42foo, :70bar))
```
That's all the deviation I can see. The rest of it either crashes:
```
<Zoffix__> m: constant @foo .=new: 1, 2, 3
<camelia> rakudo-moar f559c6d8b: OUTPUT: «===SORRY!=== Error while compiling
<tmp>␤An exception occurred while evaluating a constant␤at
<tmp>:1␤Exception details:␤ Cannot resolve caller new(Int: Int, Int);
none of these signatures match:␤ (Int $: \value, *%_)␤ (In…»
```
Or silently fails:
```
<Zoffix__> m: my Int constant foo = 'not an Int'; say foo;
<camelia> rakudo-moar f559c6d8b: OUTPUT: «not an Int␤»
```
......@@ -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-02-17 Rakudo #120 (AlexDaniel + Releasable)
2018-03-17 Rakudo #121
2018-03-17 Rakudo #121 (AlexDaniel + Releasable)
2018-04-21 Rakudo #122
2018-05-19 Rakudo #123
2018-06-16 Rakudo #124
......@@ -447,6 +446,8 @@ Previous releases were bundled as part of monthly Parrot releases.
2017-11-21 Rakudo #117 "2017.11" (AlexDaniel + Releasable)
2017-12-21 Rakudo #118 "2017.12" (AlexDaniel + Releasable)
2018-01-25 Rakudo #119 "2018.01" (AlexDaniel + Releasable)
2018-02-20 Rakudo #120 "2018.02" (AlexDaniel + Releasable)
2018-02-23 2018.02.1 (AlexDaniel + Releasable)
=head1 COPYRIGHT
......
......@@ -654,9 +654,19 @@ multi sub nativecast(Signature $target-type, $source) is export(:DEFAULT) {
$r
}
multi sub nativecast(Int $target-type, $source) is export(:DEFAULT) {
nqp::nativecallcast(nqp::decont($target-type),
Int, nqp::decont($source));
}
multi sub nativecast(Num $target-type, $source) is export(:DEFAULT) {
nqp::nativecallcast(nqp::decont($target-type),
Num, nqp::decont($source));
}
multi sub nativecast($target-type, $source) is export(:DEFAULT) {
nqp::nativecallcast(nqp::decont($target-type),
nqp::decont(map_return_type($target-type)), nqp::decont($source));
nqp::decont($target-type), nqp::decont($source));
}
sub nativesizeof($obj) is export(:DEFAULT) {
......
This diff is collapsed.
......@@ -304,7 +304,7 @@ role STD {
self
}
method typed_worry($type_str, *%opts) {
unless self.pragma('no-worries') {
if self.pragma('worries') {
self.pragma('fatal')
?? self.typed_sorry($type_str, |%opts)
!! @*WORRIES.push($*W.typed_exception(
......@@ -489,6 +489,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
# We could start out TOP with a fatalizing language in self, conceivably...
my $*FATAL := self.pragma('fatal'); # also set if somebody calls 'use fatal' in mainline
self.set_pragma('worries', 1);
# A cacheable false dynvar value.
my $*WANTEDOUTERBLOCK := 0;
......@@ -1324,7 +1325,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*QSIGIL := '';
:my $*SCOPE := '';
:my $*STATEMENT_ID := $*NEXT_STATEMENT_ID++;
:my $*IN_STMT_MOD := 0;
:my $*IN_STMT_MOD := nqp::getlexdyn('$*IN_STMT_MOD');
:my $*ESCAPEBLOCK := 0;
:my $actions := self.slang_actions('MAIN');
<!!{ $/.set_actions($actions); 1 }>
......@@ -1950,6 +1951,10 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}
token coloncircumfix($front) {
# reset $*IN_DECL in case this colonpair is part of var we're
# declaring, since colonpair might have other vars. Don't make those
# think we're declaring them
:my $*IN_DECL := '';
[
| '<>' <.worry("Pair with <> really means an empty list, not null string; use :$front" ~ "('') to represent the null string,\n or :$front" ~ "() to represent the empty list more accurately")>
| {} <circumfix>
......@@ -2747,7 +2752,9 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
]?
[ <.ws> <trait>+ ]?
[ <.ws> <post_constraint('var')>+ ]?
[ <.ws> :my $*HAS_SELF :=