Intro
Chapter:
0. History
1. Design
2. Basic
3. Var
4. Op
5. IO
6. Block
7. Sub
8. OOP
9. Regex
10. Meta
Overview
Appendix:
A. Index
B. Grouped
C. Classtree
D. Delta
E. Exciting
F. FAQ
G. Glossary
H. Href
All variables in Perl begin with a sigil. They mark the 3 primary var types. The 4th sigil is for callables (routines) and the 5th is for boxes (namespaces) that organize the previous 4.
The first 4 can also be used as prefix operators, called contextualizers, that force different contexts, but there are much more different contexts then 4.
Twigil is short for secondary sigil. They follow after a primary sigil and mark special namespaces or variables with special meanings and properties.
$foo |
ordinary scoping (no twigil) |
$.foo |
object attribute public accessor |
$!foo |
object attribute private storage |
$^foo |
self-declared formal positional parameter |
$:foo |
self-declared formal named parameter |
$*foo |
contextualizable global variable |
$?foo |
compiler hint variable |
$=foo |
pod variable |
$~foo |
the foo sublanguage seen by the parser at this lexical spot |
$_ |
context variable |
$! |
error msg |
$/ |
last created match object of this scope with these methods |
$<...> |
alias to named capture, i.e., $/<...> or $/{'...'} |
$0 ... |
alias to positional capture, like in P5 - $1 .. $9 but doesn't stop at $9 |
@() |
array that holds $0 .. $9 and rest and positional submatches |
context variable, default global (run time), any of them are now objects with several methods
@*ARGS |
Arguments (Parameter) to a program (script), formerly @ARGV |
$*ARGFILES |
magic command-line input handle |
$*IN |
standard input handle (command line mostly) |
$*OUT |
standard output (command line mostly) |
$*ERR |
standard error output (command line mostly) |
$*CWD |
current working directory (Str) |
@*INC |
include pathes (but not for std library modules), formerly @INC |
$*LANG |
LANG variable from %*ENV that defines what human language is used |
%*ENV |
system environment variables, formerly %ENV |
%*OPTS |
options from command line |
$*TZ |
local time zone |
$*EXECUTABLE_NAME |
former $0 |
$*PERL |
perl version running under, was formerly $^V or $] |
$*KERNEL |
operating system running under |
$*DISTRO |
OS distribution am I running under |
$*PID |
ID of the running process, |
$*GID |
real global ID of the running process owner, formerly @( |
$*UID |
real user ID of the running process owner (user), formerly @< |
$*EGID |
effective global ID, formerly @) |
$*EUID |
effective user ID, formerly @> |
$*ON_DIE |
exception handler, run befor die, formerly $SIG{__DIE__} |
$*ON_WARN |
exception handler, run befor warn, formerly $SIG{__WARN__} |
$*COMPILING |
|
$*EMERGENCY_MEMORY |
formerly $^M |
$*DEBUGGING |
|
compiler constants (fixed at compile time)
$?KERNEL |
for which operating System was this program compiled? |
$?DISTRO |
Which OS distribution am I compiling under? |
$?VM |
Which virtual machine am I compiling under |
$?XVM |
Which virtual machine am I cross-compiling for |
$?PERL |
Which Perl am I compiled for? |
$?ENC |
current encoding |
$?NF |
default string normalization method |
%?LANG |
Hash of Grammar # What is the current set of interwoven languages? |
$?GRAMMAR |
current grammar |
$?FILE |
current filename of source file (FILE in P5) |
$?MODULE |
current module |
$?PACKAGE |
current package (PACKAGE) |
$?CLASS |
current class |
::?CLASS |
current class (as package name) |
$?ROLE |
current role (as variable) |
::?ROLE |
current role (as package or type name) |
&?ROUTINE |
current sub or method (SUB) |
&?BLOCK |
reference to current block |
$?LINE |
current line number (LINE) |
$?TABSTOP |
|
File-scoped POD data
$=pod |
surrounding POD object |
$=data |
data block handle (=begin DATA ... =end) |
@=COMMENT |
All the comment blocks in the file |
sublanguage seen by the parser at this lexical spot
$~MAIN |
the current main language (e.g. Perl statements) |
$~Quote |
the current root of quoting language |
$~Quasi |
the current root of quasiquoting language |
$~Regex |
the current root of regex language |
$~P5Regex |
the current root of the Perl regex language |
are builtins (not exactly variables and without a sigil) that return always the same important value
The following pseudo-package names are reserved at the front of a name:
MY |
Symbols in the current lexical scope (aka $?SCOPE) |
OUR |
Symbols in the current package (aka $?PACKAGE) |
CORE |
Outermost lexical scope, definition of standard Perl |
GLOBAL |
Interpreter-wide package symbols, really CORE::GLOBAL |
PROCESS |
Process-related globals (superglobals), CORE::PROCESS |
COMPILING |
Lexical symbols in the scope being compiled |
DYNAMIC |
Contextual symbols in my or any caller's lexical scope |
The following relative names are also reserved but may be used anywhere in a name:
CALLER |
Contextual symbols in the immediate caller's lexical scope |
OUTER |
Symbols in the next outer lexical scope |
UNIT |
Symbols in the outermost lexical scope of compilation unit |
SETTING |
Lexical symbols in the unit's DSL (usually CORE) |
PARENT |
Symbols in this package's parent package (or lexical scope) |
The following is reserved at the beginning of method names in method calls:
SUPER |
Package symbols declared in inherited classes |
my |
introduces lexically scoped names |
state |
introduces lexically scoped but persistent names |
our |
introduces package-scoped names |
anon |
introduces names that aren't to be stored anywhere |
has |
introduces object attribute names |
augment |
adds definitions to an existing name |
supersede |
replaces definitions of an existing name |
In Perl 6 any variable and value is an object. Here's a list of all different types of values, represented my different classes or roles. The routine types are in a different section.
Mu |
Most Undefined |
Junction |
unordered superposition of data with and/or/one/none |
Each |
ordered superposition (conjectural) |
Failure |
Failure (lazy exceptions, thrown if not handled properly) |
Any |
Perl 6 object (default routine parameter type, excludes junction) |
Cool |
Perl 6 Convenient OO Loopbacks |
Whatever |
Wildcard (like Any, but subject to do-what-I-mean via MMD) |
Int |
Any Int object |
Widget |
Any Widget object |
Str |
Perl string (finite sequence of Unicode characters) |
Bit |
Perl single bit (allows traits, aliasing, undef, etc.) |
Int |
Perl integer (allows Inf/NaN, arbitrary precision, etc.) |
Num |
Perl number (approximate Real, generally via floating point) |
Rat |
Perl rational (exact Real, limited denominator) |
FatRat |
Perl rational (unlimited precision in both parts) |
Complex |
complex number (with an i-Part) |
Numeric |
base class to all number |
Bool |
Perl boolean |
Exception |
Perl exception |
Block |
executable objects that have lexical scope |
Range |
a pair of ordered endpoints |
Set |
unordered collection of values that allows no duplicates |
Bag |
unordered collection of values that allows duplicates |
Enum |
an immutable Pair |
EnumMap |
a mapping of Enums with no duplicate keys |
Signature |
function parameters (left-hand side of a binding) |
Parcel |
arguments in a comma list |
LoL |
arguments in a semicolon list |
Capture |
function call arguments (right-hand side of a binding) |
Blob |
an undifferentiated mass of ints, an immutable Buf |
Instant |
a point on the continuous atomic timeline |
Duration |
difference between two Instants |
HardRoutine |
a routine that is committed to not changing |
Iterator |
Perl list |
RangeIter |
Iterator over a Range |
Scalar |
Perl scalar |
Array |
Perl array |
Hash |
Perl hash |
KeySet |
KeyHash of Bool (does Set in list/array context) |
KeyBag |
KeyHash of UInt (does Bag in list/array context) |
Pair |
a single key-to-value association |
Buf |
Perl buffer (a stringish array of memory locations) |
IO |
Perl filehandle |
Routine |
base class for all wrappable executable objects |
Sub |
Perl subroutine |
Method |
Perl method |
Submethod |
Perl subroutine acting like a method |
Macro |
Perl compile-time subroutine |
Regex |
Perl pattern |
Match |
Perl match, usually produced by applying a pattern, has these methods |
Stash |
a symbol table hash (package, module, class, lexpad, etc) |
SoftRoutine |
a routine that is committed to staying mutable |
This is more low level than the last table. These types are more meant to give the compiler optimizing hints.
int1 |
|
int2 |
|
int4 |
|
int8 |
|
int16 |
|
int32 |
(aka int on 32-bit machines) |
int64 |
(aka int on 64-bit machines) |
int128 |
(aka int on 128-bit machines) |
uint1 |
(aka bit) |
uint2 |
|
uint4 |
|
uint8 |
(aka byte) |
uint16 |
|
uint32 |
|
uint64 |
|
uint128 |
|
num16 |
|
num32 |
|
num64 |
(aka num on most architectures) |
num128 |
|
complex16 |
|
complex32 |
|
complex64 |
(aka complex on most architectures) |
complex128 |
|
rat8 |
|
rat16 |
|
rat32 |
|
rat64 |
|
rat128 |
|
buf8 |
aka buf, a "normal" byte buffer |
buf16 |
a uint16 buffer |
buf32 |
a uint32 buffer |
buf64 |
a uint64 buffer |
Every value in P6 is an object and has following methods to tell more about itself.
WHAT |
short name of the class that an object belongs to |
WHICH |
object ID (type) |
WHO |
package, that support that object, long name in string context |
WHERE |
memory address of the object |
HOW |
object of meta class: "Higher Order Workings" |
WHEN |
(reserved for events?) |
WHY |
(reserved for documentation) |
WHENCE |
autovivification of closures |
all level of precedence
associativity
L |
left |
($a <op> $b) <op> $c |
(<op> $a)<op> |
R |
right |
$a <op> ($b <op> $c) |
<op> ($a <op> ) |
N |
non |
ILLEGAL |
ILLEGAL |
C |
chain |
($a <op> $b) and ($b <op> $c) |
|
X |
list |
infix:<op>($a; $b; $c) |
|
These are the categories of the main language grammar, as stored in $~MAIN. The first category called "category" is the metacategory (for all slangs) that can be used to create new categories.
The default regex language as stored in $~Regex has following categories:
appear mostly before or around regular operators and give them different meaning or greater range. They can be nested like @a X[+=] @b
, but be careful with that. In the example V stands for Value, L for left Value, and R for right. A number is the array index. Words in the second column are short explanation or an aliasing method if followed by ()
.
op= |
self assign |
known from P5, $L <op>= $R equals $L = $L op $R |
!op |
negation |
known from P5, $L !<op> $R equals !($L op $R) |
Rop |
reverse |
reverses the order of the operands |
Sop |
sequence |
like reduction, only synchronous, execution in listed order is guaranteed; suppresses any explicit or implicit parallelism |
(op) |
set |
make set operators ut of | & ! |
>>op |
hyper |
processes arrays eager and in parallel or applies a single value to all array elements, @E = $L[0] op $R[0], $L[1] op $R[1], ...; |
<<op |
hyper |
like above, points to the side which determines dimensionality, @E = $L[0] op $R[0], $L[1] op $R[1], ...; |
[op] |
reduce() |
applies the operator between all elements of an array, $result = $V[0] op $V[1] op ...; |
[\op] |
triangle() |
applies above reduction to a series of lists made of array slices ranging in length from 1 to the complete length of the original list, @result = $V[0], $V[0] op $V[1], $V[0] op $V[1] op $V[2], ...; |
Xop |
crosswith() |
performs the operator to all the pairs of the Cartesian product of two arrays; @result = $L[0] op $R[0], $L[0] op $R[1], $L[1] op $R[0], $L[1] op $R[1] |
Zop |
zipwith() |
like hyper, but evaluates lazy, @result = $L[0] op $R[0], $L[1] op $R[1], ... |
The two hyper operators and the evaluating autoquoting can be written with the unicode signs (also documented as "French Quotes") or with double lesser than or greater than signs (documented as "Texas Quotes"). Set ops have also UTF-variants.
prefix operators or functions that forcing a context.
The infix ops in the first column create junctions by combining two values (can be Junctions itself), the ops in second column are to be applied to a list as prefix op or method.
infix set ops in the first column have an equivalent Unicode version (including code point number). Operators are negated with !. Overload them with infix:<<"2208">>($a, $b --> Bool){..., number is the codepoint nr (CPNR)
(elem) |
∈ |
2208 |
∉ |
2209 |
|
True if left operand is (not) element of the right set |
(cont) |
∋ |
220B |
∌ |
220C |
|
True if right operand is (not) element of the left set |
(<) |
⊂ |
2282 |
⊄ |
2284 |
strict |
True if all elements left are in right and right set has more |
(<=) |
⊆ |
2286 |
⊈ |
2288 |
subset |
True if all elements in left set are in right set |
(>) |
⊃ |
2283 |
⊅ |
2285 |
strict |
True if all elements right are in left set and left has more (strict superset) |
(>=) |
⊇ |
2287 |
⊉ |
2289 |
supers |
True if all elements right are in left set |
(<+) |
≼ |
227C |
|
|
b.sub |
True if all elements left are in right bag and weighed less than right |
(>+) |
≽ |
227D |
|
|
b.sup |
True if all elements right are in left bag and weighed less than left |
(&) |
∩ |
2229 |
|
|
AND |
Set of elements, which are in both sets |
(|) |
∪ |
222A |
|
|
OR |
Set of elements, which are in one or both sets |
(^) |
⊖ |
2296 |
|
|
XOR |
Set of elements, which are only in one of both sets |
(-) |
∖ |
2216 |
|
|
diff |
Set of elements, which are in left, but not right set |
(+) |
⊎ |
228E |
|
|
b.add |
Bag with elements of both bags and with added weight of both |
(.) |
⊍ |
228D |
|
|
b.mul |
Bag with elements that are in both bags but weight multiplied |
When ~~ is used as infix $_ is the left side, X is right. In when clauses just X is stated. Selection of the comparison alhorithm (4th column) is based on the value types as stated in the first two columns.
Methods of IO::Path replace the Perl 5 filetest ops (like -e). Use it as in $filename.IO ~~ :X
or $filename.IO.X
.
:r |
Bool |
Path is readable by effective uid/gid |
:w |
Bool |
Path is writeable by effective uid/gid |
:x |
Bool |
Path is executable by effective uid/gid |
:o |
Bool |
Path is owned by effective uid. |
|
|
|
:R |
Bool |
Path is readable by real uid/gid |
:W |
Bool |
Path is writeable by real uid/gid |
:X |
Bool |
Path is executable by real uid/gid |
:O |
Bool |
Path is owned by real uid. |
|
|
|
:e |
Bool |
Path exists |
:s |
Int |
Path has size greater than zero |
:z |
Bool |
Path has zero size (an empty file). |
|
|
|
:f |
Bool |
Path is a plain file |
:d |
Bool |
Path is a directory |
:l |
Bool |
Path is a symbolic link. |
:L |
Str |
Actual path is a symbolic link (readlink) |
:p |
Bool |
Path is a named pipe (FIFO), or filehandle is a pipe |
:S |
Bool |
Path is a socket |
:b |
Bool |
Path is a block special file |
:c |
Bool |
Path is a character special file |
|
|
|
:u |
Bool |
Path has setuid bit set |
:g |
Bool |
Path has setgid bit set |
:k |
Bool |
Path has sticky bit set |
The basic quoting operator (Q) does nothing, just taking literally what you quoted as a string. But with several adverbs, it behaves like the well known following ops:
There are a lot more adverbs to fine tune your quoting. The Adverbs can used with any quoting operator like: Q :s/.../ or qq :p /.../.
Stay behind the regex op and change the behaviour of the regex, its search scope, etc. Most can also also put inside a subregex (in brackets).
:g |
:global |
searches for any finding |
:x(n) |
|
searches n times (n is an int) |
:nth(n) |
:st :nd :rd |
demands the nth finding, has many aliases for correct spelling (:2nd) |
:c(n) |
:continue |
searches from nth position (counting from 0) |
:p(n) |
:pos |
searches only on nth position (counting from 0) |
:ov |
:overlap |
searches on all positionens just one time (activates backtracking) |
:ex |
:exhaustive |
searches on all positions as long as it findes something (activates backtracking) |
|
:ratchet |
deactivates backtracking |
|
:panic |
overwriting of possible set :ratchet for all subrules (activates backtracking) |
|
:keepall |
subrules have to memorize everything |
:rw |
|
the regex has the right to change the string |
:s |
:sigspace |
whitespace just separate parts of the Regex, don't stand for spaces to look for |
:ss |
:samespace |
as in :s for substitutions, 1st part replaced with 1st part in second half a.s.o. (ss/teh hsa/the has/;) |
:i |
:ignorecase |
no distinctions between uppercase and lowercase |
:ii |
:samecase |
substitute with chars of same case as the matching |
:m |
:ignoremark |
comparing base characters (Unicode non-mark characters) while ignoring any trailing mark characters |
:mm |
:samemark |
substitute with chars that has same mark/accent pattern as the matched string |
|
:bytes |
searches on byte level |
|
:chars |
searches on character level (default) |
|
:codes |
matches between codepoints |
|
:graphs |
match language-independent graphemes |
:P5 |
:Perl5 |
use the Perl 5 Regex syntax |
. |
any character |
^ |
begin of the sring |
^^ |
begin of a line |
$ |
end of the string |
$$ |
end of a line |
(...) |
group patterns and capture the result |
[...] |
group patterns without capturing |
{...} |
execute a closure (Perl 6 code) within a rule |
<...> |
match a subrule (assertion |
| |
match alternate patterns (logical OR with LTM) |
|| |
match alternate patterns (sequential OR) |
& |
match multiple patterns (AND) |
** |
muliply this (meta)char/subrule times the following digit on right side |
% |
match this (meta)char/subrule as long as separated by (meta)char/subrule on the right |
%% |
like %, but allows trailing separator |
\ |
escape a metacharacter to get a literal character, or escape a literal character to get a metacharacter |
# |
mark a comment (to the end of the line) |
:= |
bind the result of a match to a hypothetical variable |
? zero |
or one |
+ one o |
r more |
* zero |
or more |
** maxim |
al greedy matching |
** mulip |
ly this (meta)char/subrule times the following digit on right side |
**? minim |
al matching |
% match |
this (meta)char/subrule as long as separated by (meta)char/subrule on the right |
%% like |
%, but allows trailing separator |
These Escape Sequences will be evaluated inside quotes to invisible control chars, if the ":b" aka ":backslash" quoting Adverbs is set (included in :quotewords and :double). They are also usable in regexes and thatswhy also included in the next list.
\a |
BELL |
\b |
BACKSPACE |
\e |
ESCAPE |
\f |
FORM FEED |
\n |
LINE FEED |
\r |
CARRIAGE RETURN |
\t |
TAB |
To be used just inside of regexes (rx/.../, m/.../, s/.../.../ and tr/.../.../).
\0[ ... ] |
character given in octal (brackets optional) |
\c[ ... ] |
named character or control character |
\C[ ... ] |
any character except the bracketed named or control character |
\d |
digit |
\D |
nondigit |
\e |
escape character |
\E |
anything but an escape character |
\f |
form feed |
\F |
anything but a form feed |
\n |
(logical) newline |
\N |
anything but a (logical) newline |
\h |
horizontal whitespace |
\H |
anything but horizontal whitespace |
\L[ ... ] |
Everything within the brackets is lowercase |
\Q[ ... ] |
all metacharacters within the brackets match as literal characters |
\r |
return |
\R |
anything but a return |
\s |
any whitespace character, \h or \v |
\S |
anything but whitespace |
\t |
a tab |
\T |
anything but a tab |
\U[ ... ] |
everything within the brackets is uppercase |
\v |
vertical whitespace |
\V |
anything but vertical whitespace |
\w |
word character (Unicode alphanumeric plus "_") |
\W |
anything but a word character |
\x[ ... ] |
character given in hexadecimal (brackets optional) |
\X[ ... ] |
anything but the character given in hexadecimal (brackets optional) |
zero-width boundaries begin with a pipe symbol. To negate put a ! in front of the pipe symbol.
<|c> |
codepoint boundary (always matches in grapheme/codepoint mode) |
<|g> |
grapheme boundary (always matches in grapheme mode) |
<|w> |
word boundary aka <wb> |
predefined rules (see routine type rule) for any grammar or regex. They can have prefixes: . (dot) marks a non-capturing subrule, ? and ! are also non-capturing positive and negative zero width assertions.
can also applied to any positional ($/[2][3].to
) and named ($/<star>.from
) submatch
$/.from |
the initial match position |
$/.to |
the final match position |
$/.chars |
$/.to - $/.from |
$/.orig |
the original match string |
$/.Str |
substr($/.orig, $/.from, $/.chars) |
$/.ast |
the abstract result associated with this node |
$/.caps |
sequential captures |
$/.chunks |
sequential tokenization |
$/.prematch |
$/.orig.substr(0, $/.from) |
$/.postmatch |
$/.orig.substr($/.to) |
aka phasers. Every block can contain special named blocks (some are only for loops) that are started at certain times. They are traits (compile time property) of a block object. Those marked with a * can also be used within an expression as in BEGIN my $x = 3 * 3;
.
BEGIN {...}* |
at compile time, ASAP, only ever runs once |
CHECK {...}* |
at compile time, ALAP, only ever runs once |
|
|
INIT {...}* |
at run time, ASAP, only ever runs once |
END {...} |
at run time, ALAP, only ever runs once |
|
|
ENTER {...}* |
at every block entry time, repeats on loop blocks. |
LEAVE {...} |
at every block exit time |
KEEP {...} |
at every successful block exit, part of LEAVE queue |
UNDO {...} |
at every unsuccessful block exit, part of LEAVE queue |
|
|
FIRST {...}* |
at loop initialization time, before any ENTER |
NEXT {...} |
at loop continuation time, before any LEAVE |
LAST {...} |
at loop termination time, after any LEAVE |
|
|
PRE {...} |
assert precondition at every block entry, before ENTER |
POST {...} |
assert postcondition at every block exit, after LEAVE |
|
|
CATCH {...} |
catch exceptions, before LEAVE |
CONTROL {...} |
catch control exceptions (like next/last/return etc), before LEAVE |
if |
when following expression evals in boolean context to True, the block that following after that will be executed |
elsif |
works like if, but only recognized if no preceding "if" or "elsif" clause was executed |
else |
following block will be executed, when no preceding "if" or "elsif" clause was executed |
unless |
opposite of if, alias to if not, no "elsif" or "else" is allowed to follow |
?? !! |
"cond ?? term1 !! term2" is short form "of if cond {term1} else {term2}" |
ff |
awk style flip flop, in P5 .. in scalar context |
fff |
sed style flip flop, in P5 ... in scalar context |
given |
evals an expression into scalar context assignes it to $_ for the following block |
when |
smartmatches an expression against $_ ; if the result is True, the following block will be executed |
default |
following block will be executed, when no "when" clause was executed |
loop |
general (endless) loop, unless used as an C-style-loop, evals following expression into void context |
while |
loop with negative exit condition (exit when False), condition, evals expression into boolean context |
until |
loop with positive exit condition(exit when True), evals expression into boolean context |
repeat |
initial command for while or until loops that have their condtion at the end |
do |
runs that block in any case one time, "do once"-loop |
for |
evals expression into lazy list context and iterates over that list from first to last value, sets each time $_ (can be combined with when as well), |
routine definition: [scope] [modifier] type [name] [trait] (signature) { block }
multi |
marks routines, which can have siblings with same name but different signature; when called, the one with matching sig is executed |
only |
routines which don't allow siblings (this is default, you may leave it out) |
proto |
fallback for multi, if no multi signature matches the caller, a proto with same name is executed |
phasers (closure traits) can also be seen as routine traits.
export |
this routine will be exported my the current module by default |
will do |
block of code executed when the subroutine is called. Normally declared implicitly, by providing a block after the subroutine's signature definition |
signature |
signature of a subroutine. Normally declared implicitly, by providing a parameter list and/or return type |
as |
inner type constraint that a routine imposes on its return value |
of |
official return type of the routine |
cached |
marks a subroutine as being memoized |
rw |
marks a subroutine as returning an lvalue |
parsed |
macro is parsed once, is hygienic, only parsed can be used |
reparsed |
macro parsed twice, not hygienic, later parsed can be used |
tighter |
specifies the precedence of an operator higher than an existing operator as seen here |
looser |
specifies the precedence of an operator lower than an existing operator as seen here |
equiv |
specifies the precedence of an operator same as an existing operator as seen here |
assoc |
specifies the associativity of an operator explicitly as seen here |
as |
data coming through that parameter will be coerced to the type following as |
readonly |
immutable parameter |
rw |
mutable parameter (rw stands for: read write) |
copy |
read-writable copy of the original argument ("pass-by-value") |
dynamic |
parameter is an "environmental" variable, a lexical in the dynamic scope |
parcel |
raw reference, will not be contextualized |
In routine and block definitions can be also some character with special meaning
! |
suffix of required parameter (default when named, not positional) |
* |
prefix of slurpy arrays |
--> |
prefix of return type |
-> |
prefix of named readonly parameters for a block (pointy block syntax) |
: |
prefix of named parameter, positional when without |
:: |
prefix of a variable type introduced in a signature |
<-> |
prefix of named writeable parameters for a block (double pointy block syntax) |
? |
suffix of optional parameter (default when positional, not named) |
^ |
prefix of metaclass methods, $obj.^methods(); is shortcut for $obj.HOW.methods($obj); |
A callframe object is generated at run-time for each call of a block of code. If a block of code includes a callframe() call, the value returned from that call is the callframe object corresponding to the block of code. To get the value of other blocks and routines higher in the call stack, use callframe with args, or caller, with or without args.
Once you have a callframe object, you can call the following methods on it:
args |
capture of args passed for this callframe |
callframe |
callframe call which navigates relative to self |
caller |
caller call which navigates relative to self |
file |
source .file corresponding to callframe |
hints |
compiler symbols in effect during originally compilation |
inline |
did control structure create callframe (rather than user) |
leave |
leave (return from) a particular callframe |
line |
line number in source .file corresponding to callframe |
my |
access to callframe's lexicals (read only) |
package |
|
Intro
Chapter:
0. History
1. Design
2. Basic
3. Var
4. Op
5. IO
6. Block
7. Sub
8. OOP
9. Regex
10. Meta
Overview
Appendix:
A. Index
B. Grouped
C. Classtree
D. Delta
E. Exciting
F. FAQ
G. Glossary
H. Href