NAME
kurila116delta - what is new for Perl Kurila 1.16
DESCRIPTION
This document describes differences between Perl Kurila 1.15 and Perl Kurila 1.16
Highlights In Perl Kurila 1.16
Structured assignments.
Core Enhancements
Structured assignments
Structured assignments are a new way, to extract values from complex structures.
For example:
%( aap => $aap, ?noot => $noot ) = $h;
$h
must be an hash with a key aap
and possible a key noot
, the corresponding values are assigned to $aap
and $noot
. Assigns $aap
to the key $noot
.
As a more basic example:
@( $a, $b ) = @list;
Assigns $a
to the first element, and $b
the second element. If there are more elements in the list an error is raised. To allow for more element do
@($a, $b, ...) = @list;
To allow assignment without two elements ad a ?
in front of the variable:
@($a, ? $b, ...) = @list;
If @list
only has only element $b
will be set to undef
. Similairly for hashes:
%( aap => $aap, ?noot => $noot, ... ) = $h;
$h
must be a hash which must have the key aap
. $aap
is assigned the value of $h{aap}
, and $noot
is assigned the value of $h{?noot}
. Extra values in a hash or array can be ignored using ...
or assigned to hash or array using @<
or %<
. For example:
@($a, @< $remaining) = @list
Assigns the first element of @list
to $a
and the remaining elements to $remaining
.
@( $a, %< $h ) = @( "arg1", "key1" => "value1" );
After the assignment $a
is "arg1"
and $h
is %( "key1" => "value1" )
Rationale
Improve assignments.
Controlled hash and array element access and creation
Default when you access a hash key or array element which does not exists an error is raised. To automaticly create the hash key or array element if it does not exists, add the +
operator to the key, i.e. $h{+$key}
. To ignore accessing a non-existent key or element, add the ?
to the key, i.e. @a[?$i]
.
Rationale
Direct control over the creation and access of hash and array elements.
Removed list assigments
List assignments are no longer possible
Rationale
List assignments have been removed in favour of structured assigments.
KNOWN BUGS
Documentation
Documentation has not been updated for many of the changes for kurila.
Self referential assignment problems
Assigning some value to a part of itself behaves unexpected.
Tied hashes with complex data
Tied hashes do not work correctly with complex data structures. Assigning arrays or hashes to a value of tied hash might behave strange.
Limited platform support
Perl Kurila has only been tested/build for x86_64-linux-gnu-thread-multi platform.
SEE ALSO
The INSTALL file for how to build Perl Kurila.
The README file for general stuff.
The Artistic and Copying files for copyright information.
HISTORY
Written by Gerard Goossen <gerard@tty.nl>.