##################################################################################
##################################################################################
##################################################################################
###
### NOTE: this is an "internal", core dev only file that is a work in
### progress. It is likely INCOMPLETE and INACCURATE. To avoid
### confusion, please do not distribute this file to users as
### an indication of upcoming language changes.
###
### If you are a user reading this, you probably should not modify
### your code based on this file, until a user copy without this
### notice is publicized. This will avoid unnecessary or inaccurate changes.
###
###
##################################################################################
##################################################################################
##################################################################################
This document lists changes in Perl 6.d (Diwali) language from Perl 6.c (Christmas) version. A particular implementation of the language may contain additional changes; please consult with the changelog for your implementation.
At the same time, a particular implementation may have had certain features already implemented during 6.c version period. This ChangeLog concerns itself with new features added to the specification on a language level and not the status of their implementation in a particular compiler.
This ChangeLog is targeted towards language users, to help with preparation to use compilers supporting latest language version. Thus, it does not contain every minute change to the specification that occurred. Implementations wishing to ensure full compliance with the new version of the language specification should execute the test suite available at https://github.com/perl6/roast/ and examine any failing tests.
There are new features that did not exist in 6.c language. For full details about them, please consult with the language documentation on https://docs.perl6.org/ Items in Version-Constrolled Changes section are protected by version pragma and older behaviours can be obtained by explicitly using use v6.c to request an older language version. All other changes do not conflict with the 6.c language version and implementations may choose to make them available even when an earlier language version is requested.
- [6.d]
&await
no longer blocks a thread while waiting - [6.d]
whenever
not in lexical scope ofreact
throws - [6.d]
$*ARGFILES
insidesub MAIN
is always fed by$*IN
- [6.d] Constructs (literally)
$()
,@()
, and%()
are no longer magical - [6.d] variables with
:D
/:U
type constraints default to type object of the constrained type (e.g. so you could use.new
with them) - [6.d]
start
blocks in sink context attach exception handler - [6.d] Routines must use
return-rw
to return aProxy
, even if routine is marked asis raw
oris rw
- [6.d] Native
num
types default to0e0
instead ofNaN
- [6.d] On subroutine names, the colonpair with key
sym
(e.g.:sym<foo>
) is reserved, in anticipation of possible future use.
These methods are deprecated in 6.d language and will be removed in 6.e. Implementations may choose to emit deprecation warnings or to offer these methods for a longer period than 6.e release.
- The use of
'-'
(single hyphen) as a special path to&open
to mean the special handles (useIO::Special
objects instead) IO::Handle.slurp-rest
(use.slurp
instead)Any.flatmap
(use combination of.flat
and.map
methods instead)Cool.path
(use.IO
instead)Pair.freeze
(usePair.new
with decontainerized arguments instead)Str.subst-mutate
(useStr.subst
with.=
methodcall assign metaop instead)Rational.norm
(Rational
types are required to be normalized on creation now)IO::Path.child
(use.add
instead)&undefine
(assignEmpty
/Nil
directly, instead):count
argument on&lines
/Str.lines
routines (use.elems
call on returnedSeq
instead)&is_approx
in Test.pm6 (use the very similar behaviour of&is-approx
instead)
- Improved custom handling of
sub MAIN
via new definable&RUN-MAIN
,&ARGS-TO-CAPTURE
, and&GENERATE-USAGE
subs QuantHash
es/Map
in%
variables andList
in@
variables can be declared withis
trait (e.g.my %h is Set
)- New
<ww>
regex rule: match within word only - Loops can produce a list of values from the values of last statements
next
/last
/redo
in a loop that collects its last statement values returnEmpty
for the iterations they run on.perl
can be called on consumedSeq
s, multi-dimensional arrays,Date
, andCallFrame
.gist
can be called onAttribute
- Numerous improvements to auto-generated
USAGE
message is hidden-from-USAGE
trait to hidesub MAIN
candidates from auto-generatedUSAGE
messageParameter.perl
includes introspectable defaults%*ENV
values are allomorphic- Trying to use variables
$;
,$,
,$.
,$\
,$(
,$)
,$<
,$>
,$/
,$\
,$[
,$-
,$+
, and$@
throwsX::Syntax::Perl5Var
- Default
Hash.of
returns aStr(Any)
coercer type object - Non-ASCII numerics can be used in
:42foo
colonpair shortcut StrDistance
stringifies to its.after
string- More well-defined formatting of Pod tables
Enumeration.enums
returns aMap
.Range
on various integer types returns the range of values they supportmin
/max
routines also work onHash
esSignature
literals can contain string/numeric literals as well as the invocant markerList.invert
maps via a requiredPair
binding, resulting in potential type check failures:exists
can be used with multi-dimensional associative subscripts- Dynamically created lists can be used to define an enum
- Junctions can be used as a matcher in
.first
- Native attributes can be used as bind targets in parameters
Proc
can work withIO::Pipe
s from otherProc
s- Typed arrays can be created with both
my SomeType @array
andmy @array of SomeType
- Items with negative weights are removed when coercing
a
Mixy
toSetty
/Baggy
:nth
adverb onm//
accepts aJunction
as argumentCX::Warn
andCX::Done
can be caught insideCONTROL
phasernext
can be used inwhenever
require
'd symbols no longer transitively exposed- Multi-dimensional access via
{…}
, similar to how it works with[…]
- Any open handles at
END
time get automatically closed - On a cached
Seq
, the cached list is used when&infix:<eqv>
,.Slip
,.join
,.List
,.list
,.eager
,.Array
and.is-lazy
are called IO::Handle.encoding
takesNil
to indicate switch to binary modeis default
trait works with attributes- Parameters with
is rw
trait are considered narrower in multi dispatch than thouse without it .gist
ofArray
,Blob
, andMap
gets trimmed to 100 elements- New
for
statement modifiershyper for
,race for
, andlazy for
for
loop automatically serializesRaceSeq
/HyperSeq
; use newfor
statement modifiershyper for
/race for
to avoid&infix:<does>
can be used with non-composable instances on RHS- Numeric comparators can be used with
DateTime
objects Pod
preserves the type of whitespace- Defined semantics for
@
-,%
- and&
-sigilledconstant
s
Rational
s are always reduced on creation and remain immutable throughout their life-Inf
,Inf
, andNaN
can be round-tripped through aRational
type by being represented as values<-1/0>
,<1/0>
, and<0/0
> respectively. Zero-denominatorRational
s are normalized to one of those three values- Calling
.Int
on ±Inf
andNaN
throws - Improved IEEE 754-2008 compliance in
Num
operators and math functions - Negative zero
Num
(-0e0
) gets correctly handled by all routines and syntactical constructs - Stringification of
Num
type is required to be roundtrippable to the originalNum
- Defined
Complex
exponentiation involving zeros - Negative powers in
.expmod
are valid
- Set operators can be used on any object, which will be coerced when needed
- So no pre-coercion is needed or wanted
- Set operators are at liberty to not create any QuantHash if they can perform the desired functionality without them
- Set operations on different types of QuantHashes will coerce to the most liberal form (Set -> Bag -> Mix)
- The set_precedes family of set operators (
(<+)
,≼
,(>+)
,≽
) has been removed- Used to be a Baggy form of the subset operator
- QuantHashes are upgraded to their most liberal form,
so
(<=)
,⊆
,(>=)
,⊇
do the right thing
.classify-list
method is available onBaggy
types.categorize-list
method is available onBaggy
types.invert
method is available on coreQuantHash
types.antipairs
method can be used onQuantHash
typesQuantHash
types have.new-from-pairs
and methods to convert oneQuantHash
type to another (e.g..Bag
method onSet
type).hash
onQuantHash
types does stringify keys
Date.new
accepts a:&formatter
.first
can take:$kv
unique
and.repeated
can take:&as
and:&with
&plan
in Test.pm6 can take:skip-all
&run
/&shell
can take:merge
¬e
can be called with no argumentsopen
accepts:out-buffer
IO::Path.resolve
can take:completely
IO::Path.parent
can take anInt
indicating parent levelProc::Async.new
slurps positional argumentsSignature.ACCEPTS
accepts non-Signature
/Capture
arguments&EVAL
can take aBlob
Promise.keep
/.break
can be called with no arguments.sum
on native arrays can take:wrap
is required
trait can now take an argument indicating reasonIO::Socket::Async.listen
can bind to port0
to ask OS for a free port.encode
can take:translate-nl
- New
atomicint
Unicode operators and ASCII alternatives that guarantee thread-safe, atomic operation:&infix:<⚛=>
/&atomic-assign
,&prefix:<⚛>
/&atomic-fetch
,&prefix:<++⚛>
/&atomic-inc-fetch
,&postfix:<⚛++>
/&atomic-fetch-inc
,&prefix:<--⚛>
/&atomic-dec-fetch
,&postfix:<⚛-->
/&atomic-fetch-dec
,&infix:<⚛-=>
/&infix:<⚛−=>
/&atomic-fetch-sub
, and&infix:<⚛+=>
/&atomic-fetch-add
&cas
: atomic compare and swap- The
≤
,≥
, and≠
operators are Unicode operator alternatives to<=
,>=
, and!=
respectively &infix:<unicmp>
/&infix:<coll>
: alternative behavior of&infix:<cmp>
TR///
: non-mutating version oftr///
submethod TWEAK
: similar toBUILD
, except it's compatible with attribute defaults&duckmap
: apply&callable
on each element that behaves in such a way that&callable
can be applied&deepmap
: apply&callable
on each element, descending intoIterable
s&take-rw
: like&take
but with a writable container&indir
: execute code in a given$*CWD
&spurt
: seeIO::Path.spurt
&prompt
: prompt user for inputuniprops
: multi-character version ofuniprop
symlink
: create a file symlinklink
: create a file hardlink.hyper
/.race
: process a list of values in parallelSeq.from-loop
: generate aSeq
from aCallable
Str.uniparse
: parse one or more Unicode character names into the actual charactersStr.parse-base
: inverse ofInt.base
operationIO::Path
provides.ACCEPTS
,.SPEC
,.CWD
,.Numeric
,.add
,.extension
,.mode
and numerious file tests,.parts
,.sibling
, and.spurt
IO::Handle
provides.READ
,.WRITE
,.EOF
,.DESTROY
,.readchars
,.flush
,.lock
,.unlock
,.out-buffer
,.tell
,.say
,.slurp
,.seek
,.printf
,.print-nl
, and.watch
IO::Pipe
provides.proc
Iterator
provides.skip-one
,.skip-at-least
, and.skip-at-least-pull-one
Mu.emit
: method form of&emit
&fails-like
in Test.pm6 module: allows testing for Failures&bail-out
in Test.pm6 module: exit out of failing test suite&is-approx
in Test.pm6 module: test a number is approximately like anotherBuf
has.allocate
,.reallocate
,.append
,.push
,.pop
,.splice
,.subbuf-rw
,.prepend
, and.unshift
methodsRange
supports.rand
Backtrace
has methods.map
,.flat
,.concise
, and.summary
.classify-list
method is available onHash
types.categorize-list
method is available onHash
typesCode.of
: returns the return type constraintCode.line
/.file
: returns the line/file of definitionProc::Async
provides.Supply
,.ready
,.pid
,.bind-stdin
,.bind-stdout
, and.bind-stderr
Proc.command
/Proc::Async.command
: the command we're executingProc
provides.signal
,.pid
, and.encoding
Complex
provides.cis
,.reals
,.ceiling
,.floor
,.round
,.truncate
, and.abs
methods and can be compared with<=>
(as long as the imaginary part is negligible)DateTime
provides.offset-in-hours
,.hh-mm-ss
, and.Date
DateTime
can be compared with otherDateTime
objects using<=>
operatorDate
provides.DateTime
method&infix:<+>
/&infix:<->
can be called withDuration
,DateTime
, andReal
typesEnumeration
provides.Int
,.pred
,.succ
,.kv
, and.pair
.Date
can be called on anInstant
- Junctions can be created using
Junction.new
call List
type has.to
and.from
methodsMap
type providesInt
method, returning the number of pairsAny.skip
: skip values in a listAny.batch
: more basic cousin of.rotor
Mu.iterator
: produce anIterator
for values in a listIO::Spec::*
types provide.tmpdir
,.extension
, and.path
Pair
provides.ACCEPTS
,.Pair
, and.invert
.Capture
method is well-defined for all core types- Defined semantics of
.ACCEPTS
on allomorphs Failure.self
explodes unhandledFailure
sThread.is-initial-thread
: are we running in the initial thread?Match
provides.Int
and.actions
IO::Socket::Async
provides.socket-port
and.peer-port
Promise
provides alternative constructors.kept
and.broken
WhateverCode
provides.assuming
WhateverCode
andBlock
provide.cando
.:<…>
syntax for calling prefix operators as postfixes$*KERNEL
provides.hostname
Nil
has.FALLBACK
special method defined to returnNil
atomicint
: a nativeint
sized to be usable with new atomic operatorsLock::Async
: a non-blocking mechanism for mutual exclusionEncoding::Registry
: manage available encodingsEncoding::Encoder
: encoder for a specific encodingEncoding::Decoder
: decoder for a specific encodingIO::CatHandle
: use multiple read-onlyIO::Handle
s as if they were one- Native
str
arrays Supplier::Preserving
: cached liveSupply
factorySemaphore
: control access to shared resources by multiple processesIO::Special
: a path to special I/O device (e.g.STDOUT
)Exceptions::JSON
an implementation of custom exceptions handler (can be used withPERL6_EXCEPTIONS_HANDLER
env var)SeekType
enum: values for use inIO::Handle.seek
$*USAGE
: available insideMAIN
subs and contains the auto-generated USAGE message%*SUB-MAIN-OPTS
: settings for behaviour ofsub MAIN
%*SUB-MAIN-OPTS<named-anywhere>
allow named arguments to be placed at any position on the command line
$*COLLATION
: configures the four Unicode collation levels$*INIT-INSTANT
: anInstant
representing program startup time$*HOME
: user's home directory, if one exists&*chdir
: aCallable
containing a variant ofIO::Path.chdir
that also sets process's current directoryPERL6_TEST_DIE_ON_FAIL
environmental variable: stop test suite on first failurePERL6_EXCEPTIONS_HANDLER
environmental variable: specify custom exceptions handler class
UInt
smartmatchesTrue
withInt
type objectsink
statement prefix explodesFailure
s- Defined behaviour of
permutations
/combinations
on 1- and 0-item lists and negative and non-Int arguments &val
,Str.Numeric
, and otherStr
numeric conversion methodsfail
when trying to convert UnicodeNo
character group or synthetic numerics- Synthetic numerics cannot be used in
:42foo
colonpair shortcut - An
Enumeration
can now be used as a array shape specifier - Numeric conversion of
Str
containing nothing but whitespace returns0
now samemark
with empty pattern argument simply returns the invocant.polymod
can be used withlazy
but finite lists of divisors.[*-0]
index is defined- Negative gaps in
.rotor
that are larger than the sublist throw - Non-
Int
arguments to.rotor
get coerced toInt
.lines
is defined when reading/proc
files- Defined behaviour of Thai numerals in postfix/prefix
++
/--
on strings map
inside sunkfor
is treated as sunk- Sunk
for
loop sinks value of last statement's method call .Int
onBool
objects returns anInt
objectsplice
can be used to extend an arrayclassify
works withJunction
s.pairup
on a type object returns an emptySeq
.pairup
always returns aSeq
- Synthetic codepoints are rejected from
Date
/DateTime
constructors ⸨
/⸩
pair can now be used as matching characters in quoting constructs.flat
on anArray
type object simply returns that type object- Mixed-level
classify
onHash
es throws Junction
s can be used to specify multiple keys toHash
es- The
Callable
given to.classify-list
is now guaranteed to be executed only once per each item :delete
on associative lookup onHash
type object returnsNil
is-deeply
from Test.pm6 automatically.cache
sSeq
s given as arguments and uses the returnedList
s for testingComplex.new()
gives<0+0i>
Int.new
is now guarantied to construct a newInt
(rather than, say, re-use one from a constants cache)- 1-arg versions of
&infix:<=:=>
and&infix:<eqv>
are defined Nil
type now throws if directly or indirectly calling.BIND-POS
,.BIND-KEY
,.ASSIGN-POS
,.ASSIGN-KEY
,.STORE
,.push
,.append
,.unshift
,.prepend
Nil.ord
returns an emptySeq
Nil.chrs
returns a"\0"
Num.new
coercers argument toNum
infix:<Z>()
returns an emptySeq
.comb
always returns aSeq
- Reduce with
&infix:<+>
with one item simply returns that item ()[0]
returnsNil
- Regex smartmatching is allowed on (possibly-infinite)
Seq
- Defined smartmatching with
Range
objects Set
converted to aMix
/Bag
no longer hasBool
weightsgcd
is defined when one or more operands are0
Junction
s autothread indefined
routinesum
can handle lists withJunctions
in themGrammar.parse
lets topregex
backtrack- The
U+2212 MINUS SIGN [Sm] (−)
is now supported by more constructs, such asStr.Numeric
and&val
- Arity-1
&infix:<~>
works withBlob
s - All
Numeric
literals are supported as value literals in signature \b
and\B
in regexes throwX::Obsolete
True
andFalse
as value literals in signatures warn- Return type of
.sort
andIO::Spec::Unix.path
is alwaysSeq
- Out-of-range
.AT-POS
onRange
objects returnsNil
Pair.AT-KEY
for non-existent key returnsNil
- All
Cool
types provide.Rat
/.FatRat
coercers IO::Path
filetests do not cache results of earlier test executionsSeq
eqvList
asFalse
based on type mismatch alone- On arrays,
Hash
es, andQuantHash
es, values from.kv
,.values
, and.pairs
sequences are writable &infix:<∘>
/&infix:<o>
keep LHF's.of
and RHS's.arity
and.count
- Refined accepted arguments in regex operator adverbs (e.g.
:in(…)
) - Refined accepted combinations of arguments in
IO::Handle.open
IO::Path.Str
does not include the value of.CWD
attributeIO::Path
type rejects paths with thenul
byte ("\0"
) in themIO::Pipe
's.path
/.IO
return anIO::Path
type objectIO::Path
's.copy
/.move
fail
if destination and original are the samedir
-createdIO::Path
s' absoluteness is controlled by the invocant- More-defined edge-case behaviour,
Callable
handling,.defined
calling, and chaining of&infix:<andthen>
,&infix:<orelse>
, and&infix:<notandthen>
operators - Zen slicing of
Seq
s does not cache them List.Capture
stringifies keys of any containedPair
objects&fail
with handledFailure
argument marks it as unhandleduse lib
acceptsIO::Path
objects- Anchors
^
,^^
,$
, and$$
are valid in lookarounds Grammar.made
supports type objects.isa
supportssubset
type objects:delete
can be used on lazy arrays&infix:<eqv>
can work with certain cases of lazy arguments- Dynamic lookup (
::(…)
) is restricted regex syntax and requiresuse MONKEY-SEE-NO-EVAL
clearance - Defined
.Slip
and.List
on arrays with holes Promise.in
/.at
andSupply.interval
work with zero and negative valuesSupply.interval
minimum value is0.001
; lower values are treated as0.001
and emit warningsSupply
provides.Seq
,.list
, and.zip
- Can bind to native type attributes in build methods
WhateverCode
propagatesuse fatal
say
,note
,put
,print
, andprintf
routines autothreadJunction
sIO::Handle.eof
value changes accordingly when.seek
ing past end and back- Defined
.succ
,.pred
, and.Bool
on allomorphs - Defined
.Bridge
on coreNumeric
s - Defined
.Numeric
/.Real
on type objects of coreNumeric
s - Defined
Rational.Bool
with respect to zero-denominator rationals say
/note
guaranteed to call.gist
on subclasses ofStr
- Defined
Junction.Str
returns aJunction
- Defined
Junction.gist
/.perl
return aStr
Map
/Hash
's.list
/.cache
return aList
- Defined
.round
's return type - Defined
Enumeration:D
not does.ACCEPT
anEnumeration:U
- The
IO::ArgFiles
type is just an empty subclass ofIO::CatHandle
- Constraints on constants
- Constraints are fully enforced
- Attempting to parametarized type constraints on constants
(i.e. using
my Foo constant @int
) throwsX::ParametricConstant
exception
Pod
=defn
(definition list) directive is availablePod
provides:numbered
config key.^ver
,.^auth
, and.^name
metamethods are available onmodule
and are absent on apackage
, by design- Fancy quotes (
’…’
,“…”
,「…」
, and variants) are supported inqww<…>
&infix:< >
supports lookup of autogeneratedCallables
(e.g.&infix:<XX>
)- Using a named
anon
sub no longer produces redeclaration warnings - Extended spec of
::?MODULE
/$?MODULE
variable sub MAIN
can accept anEnumeration
type constraint andwhere
clause on arguments- Type smiley constraints can be used on subsets
start
blocks and thunks get fresh$/
and$!
R
meta operator used with list-associative operators is defined- Type coerces can be used in signature return type constraints
&infix:<x>
/&infix:<x>
throw with-Inf
/NaN
repeat arguments- Literal constructs
put
andput for
throw, requiring use of parentheses - Expanded specification coverage of Unicode routines and features - Upgraded coverage to Unicode version 11
$.
method call syntax shorthand works with meta-methods