|
Perl 6
Perl 6 Delta Tablet: Revision 1
"Overview"[Perl 6 Tablets] - Chapter: "0:Intr"[Perl 6 Intro Tablet], "1:Hist"[Perl History Table], "2:Design"[Perl Language Design Table], "3:Var"[Perl Variables Table], "4:Op"[Perl Operators Table], 5:IO, 6:{}, 7:Sub, 8:OOP, 9:Rx - Appendices: "A:Index"[Perl 6 Index Tablet], "B:Tables"[Perl 6 Lookup Tablet], "C:Best of"[Best Of Perl 6 Tablet], *"D:Delta"[Perl 6 Delta Tablet]*, "E:Links"[Perl 6 Links Tablet]
---- {toc: } This summary lists things people should be aware of, that change from Perl 5 to 6. ^^ Changes * use strict and warnings are on by default * consistent sigils: so @array[1] replaces $array[1] and %hash{'key'} replaces $hash{'key'} or @hash{'key', 'key2'} * arrays, hashes, formats, directories and filehandles are internal objects with procedural Interfaces and can be saved in scalar variables. * special variables have their own namespace ($VARNAME and $?VARNAME), also token (__LINE__) will now be found there * Methods: . (dot) replaces -> (arrow) : object.method; * concatenate strings: ~ (tilde) instead of . (dot): $string = 'Shinmen Musahashi: ' ~ 'Sho Rin No Sho'; * smartmatch (regex and more): ~~ instead of =~ * < ... > replaces qw( ... )(exists still): interpolating << ... >> * ternary operator: ?? ... !! ... instead of ? ... : ... * no more 'foreach'. 'for' now iterates only on arrays * c-style loops: loop ( ; ; ) instead of for ( ; ; ) * after loop flow control: repeat { ... } while ... ; replaces do { ... } while (...); * define classes with 'class' and modules with 'module' * no more source filters, but macros * no more references, bind variables on the symbol table ^^ News * new contexts: hashlist, lazy list, bool, int, num, string * optional typing, traits (properties of variables), binding * loop and say commands * zip, err, yadda and pipe operators * hyper / reduction operators * chained comparison operators * case construct with given and when * junctions : if $a = 1|2|3 * currying * smartmatch / rules (regex++, own sublanguage within the language like in Rebol) * named parameters for subroutines, multimethods, coroutines * more explicit OOP: ** autogenerated getters/setters ** roles (similar to Ruby's Mixins, or Java's Interfaces) * delegation, design by contract (Eiffel) * exceptions, continuations * macros ^^ Native Perl 6 * no parentheses required for control expressions after if, unless, while ... (but still allowed) * $hash<key> instead of $hash{'key'}, or $hash<<key>> instead of $hash{"key"} ---- "Overview"[Perl 6 Tablets] - Chapter: "0:Intr"[Perl 6 Intro Tablet], "1:Hist"[Perl History Table], "2:Design"[Perl Language Design Table], "3:Var"[Perl Variables Table], "4:Op"[Perl Operators Table], 5:IO, 6:{}, 7:Sub, 8:OOP, 9:Rx - Appendices: "A:Index"[Perl 6 Index Tablet], "B:Tables"[Perl 6 Lookup Tablet], "C:Best of"[Best Of Perl 6 Tablet], *"D:Delta"[Perl 6 Delta Tablet]*, "E:Links"[Perl 6 Links Tablet] ---- |