← Contents

Appendix A

The Tag Sets

The closed enumerations everything else switches on.

VT — runtime value tags

src/Value.h. Eighteen tags. Several Raku types are an existing tag plus a marker rather than a tag of their own; those are listed in the second table.

The field names are the original struct's. In the 32-byte Value only i, n, s, hashKind and the flags are members; every other name in the table is an accessor of the same spelling — v.arr(), v.ratN(), v.rFrom() — over the payload slot or the cold block (Chapter 8).

TagLive fieldsNotes
Nil—the absent value
Any—the default undefined value
Boolb
Inti, or big when it overflowsenumName/enumType make it an enum value
Numn
Strs
Arrayarr, isList, itemized, shape, extList, Seq, Junction and lazy sequences all live here
Hashhash, hashKind, objKeyedSet, Bag, Mix, Proxy, Failure, Date and more
Codecodesub, block, method, builtin, WhateverCode
RangerFrom, rTo, rExFrom, rExTo, rNum, extext holds the original endpoint objects
Pairs or pairKey, pairVal, namedArg
Typesa type object; s is the type name
Whatever—*
Objectobja user class instance
RatratN, ratD, fatRatnormalised, denominator positive
Regexs (pattern), hashKind (flags)
Matchs, rFrom, rTo, arr, hashfive fields live at once
Complexn (real), im (imaginary)

Types with no tag of their own

Raku typeRepresentation
List, SeqArray with isList
an itemized arrayArray with itemized
JunctionArray with enumName in any/all/one/none
a lazy or infinite sequenceArray with a LazySeqState in ext
Set, Bag, Mix, and their mutable formsHash with hashKind
ProxyHash with hashKind == "Proxy", holding FETCH/STORE
FailureHash with hashKind == "Failure"
Date, DateTimeHash with hashKind
BufStr with hashKind == "Buf" and an identity token in ext
BlobStr with hashKind, compared by value
Instant, DurationNum with hashKind and an identity token
IntStr, RatStr, NumStr, ComplexStrthe numeric tag plus s and hashKind
an enum valueInt with enumName and enumType
FatRatRat with fatRat
a native integer containerany numeric tag with natBits and natSigned
my int @a, my num @aArray whose payload is the elements as machine words (PK::Packed); it unpacks itself into an ordinary list when something asks for one
Promise, Channel, Supply, Tap, Locka tag plus state in ext

PK — payload kinds

src/Value.h. Ten kinds. A Value has one payload slot, and this byte says what is in it. It is distinct from VT on purpose: a handful of sites convert a value in place, tag first and payload after, and a slot that describes itself keeps that legal.

KindThe slot holds
Nonenothing
Lista ValueList: an Array, List or Seq
Hasha ValueHash
Codea Callable
PairVa Pair's value
Objan ObjectData
Matcha MatchData: positional captures, named captures and .made at once
Cella shared container: the one Value every name bound to a variable holds. Only a scope's storage holds one
Packeda native int or num array's elements as machine words
Rata Rat's numerator and denominator

NK — AST node kinds

src/Ast.h. Forty-nine kinds.

Expressions. IntLit, NumLit, StrLit, InterpStr, BoolLit, VarExpr, ListExpr, Assign, Binary, Unary, Call, MethodCall, Index, Ternary, Range, Pair, BlockExpr, ArrayLit, HashLit, NameTerm, RegexLit, SubstLit, ChainExpr, SymbolicRef, AllomorphLit, NqpOp, Whatever, SelfTerm.

Statements. ExprStmt, VarDecl, SubDecl, IfStmt, WhileStmt, ForStmt, LoopStmt, Block, ReturnStmt, LastStmt, NextStmt, RedoStmt, UseStmt, EmptyStmt, GivenStmt, WhenStmt, RepeatStmt, ClassDecl, EnumDecl, NamedRegexDecl, SubsetDecl.

A great deal of Raku's surface syntax lowers into a few of these. Every operator — built-in, meta, hyper, set, and every user-declared one — is a Binary, Unary or Call. class, role, grammar, module and package are all ClassDecl. A phaser is a Block with a name.

K — regex node kinds

src/Regex.h. Twenty kinds.

KindConstruct
Lita literal string
Any.
Class<[…]>, \d, <:Nd>, a named class
Seqconcatenation
Alt| (ranked) and || (first match)
Conj&
Rep*, +, ?, ** N..M, with % separators
Group[ ], ( ), $<x>=[…]
AnchorStart, AnchorEnd^, $, ^^, $$
WBLeft, WBRight<<, >> word boundaries
Nopan empty branch
Subrule<name>, <.name>, <alias=rule>, <r($x)>
Look<?…>, <!…>, <?after …>
Code{…}, <?{…}>, <!{…}>, :my
VarMatcha $var atom evaluated at match time; backreferences
CapStart, CapEnd<( and )>
CondRef(?(N)yes|no) under :P5 — branch on group N's state

NqpOpc — the use nqp subset

src/Ast.h. 176 operation codes. The first groups are the ones the subset began with: lazy control forms, 64-bit integer operations, codepoint-indexed string operations, list and hash primitives, object and attribute helpers, and buffer read and write. The enum is append-only, because the AST cache stores the codes, and what has been appended since is whatever a real module was found reaching for: the big-integer _I family, file handles, stat and directory walks, the Unicode property lookups, and exception objects. Chapter 35 has the mechanism.

Exception and control structs

src/Interpreter.h for the control structs; the last six are declared beside the component that throws them.

StructMeaning
RakuErrorevery user-visible Raku exception: payload plus message
ReturnExreturn across a callable boundary
LastEx, NextEx, RedoExlabelled or cross-frame loop control
BreakGivenExwhen / succeed across a boundary
ProceedExproceed
LeaveExleave
ResumeEx.resume inside a CATCH
DoneExdone in a supply, whenever or react body
StopGatherExa lazy gather has produced enough
ControlHandledExa CONTROL phaser handled a warning and did not resume; its block is left
BuildFailureExa BUILD or TWEAK answered a Failure, which .new then returns
ExitExexit
WorkerAbortExunwind a background worker at shutdown — deliberately not a RakuError
ParseErrora compile-time diagnostic, optionally typed
CodegenError--exe cannot transpile this; bundle instead
AstEmitError--aot cannot rebuild this; bundle instead
AstSerialErrora cache entry is unreadable; parse instead
StepLimitExceededa regex exceeded its backtracking budget
ObsoleteEscapea retired Perl 5 metacharacter in a pattern