Glossary
Abstract class
The generic Computer Science term "abstract class" defines the interface or API of a class. In Raku, this is implemented using roles with stubbed methods.
role Canine {
method bark { ... } # the ... indicates a stub
}
class Dog does Canine {
method bark { say "woof" } # *MUST* be implemented by class
}
Advent calendar
In the context of Raku, a yearly set of blog posts for each day from the 1st until the 25th of December, to be found at https://raku-advent.blog.
Adverb
Generically, an adverb is a named argument to a function. There are also some specific syntax forms that allow adverbs to be tucked into some convenient places:
q:w"foo bar"; # ":w" is a Quotelike form modifier adverb
m:g/a|b|c/; # ":g" is too
@h{3}:exists; # ":exists" is too, but is known as a subscript adverb
Adverbs are usually expressed with colon pair notation, and for this reason colon pair notation is also known as the adverbial pair form:
:a(4) # Same as "a" => 4
Some other forms that use a colon in ways that have adverb-like semantics are called adverbial forms. One special form starts with an integer value, followed by a name (for the key):
:20seconds # same as seconds => 20
Also see Colon pair and colon list.
Adverbial pair
A generalized form of pair notation
. They all start with the colon,
as shown in the following examples:
adverbial pair | pair notation |
---|---|
:foo<bar> | foo => 'bar' |
:foo(42) | foo => 42 |
:42foo | foo => 42 |
:$foo | foo => $foo |
:foo | foo => True |
:!foo | foo => False |
Also see Adverb and Colon pair and colon list.
Allomorph
A type that has two related values which may be used depending on the
context. For example IntStr allomorph is
both
an Int and a Str, so it will be accepted by
anything that expects an Int, a Str, or an IntStr. Keep in mind
that certain constructs, such as sets, bags, and mixes
care about object identity, and so will not accept an allomorph as equivalent
of its components alone.
The allomorph types IntStr, NumStr, RatStr and ComplexStr may be created as a result of parsing a string quoted with angle brackets:
say <42>.^name; # OUTPUT: «IntStrâ€Â»
say <42.1e0>.^name; # OUTPUT: «NumStrâ€Â»
say <42.1>.^name; # OUTPUT: «RatStrâ€Â»
Note: angle brackets can also be used to create literals for which you'd
normally need to use some operator (e.g. /
for Rat or +
for
Complex). This allows you to use such literals in places where
expressions are not allowed, for example, as literals in signatures:
# Wrong, can't use an operator there:
multi foo (1/3) { say "It's one third!" }
# Right, a Rat literal:
multi foo (<1/3>) { say "It's one third!" }
If you do want an allomorph and not a literal Numeric, then include whitespace around angle brackets:
say <42/1>.^name; # OUTPUT: «Ratâ€Â»
say <42+0i>.^name; # OUTPUT: «Complexâ€Â»
say < 42+0i >.^name; # OUTPUT: «ComplexStrâ€Â»
say < 42/1 >.^name; # OUTPUT: «RatStrâ€Â»
Please see the Numerics page for a more complete description on how to work with these allomorphs.
Anonymous
A subroutine, method or submethod is called anonymous if it can't be called by name.
# named subroutine
sub double($x) { 2 * $x };
# anonymous subroutine, stored in a named scalar
my $double = sub ($x) { 2 * $x };
Note that it is still allowed to have a name, but you cannot call it by that name:
# anonymous, but knows its own name
my $s = anon sub triple($x) { 3 * $x }
say $s.name; # OUTPUT: «tripleâ€Â»
say triple(42); # OUTPUT: «Undeclared routine: tripleâ€Â»
API
Application Programming Interface. Ideally, someone using your system or library should be able to do so with knowledge only of the API, but not necessarily knowing anything about the internals or the implementation details.
See also abstract class.
Apocalypse
A document originally written by TimToady, in which he processed the initial barrage of RFCs that came out of the Perl community. Now only kept as a historical document for reference. See also Exegesis and Synopsis.
Arity
The number of Positional operands expected by an operator, subroutine, method or callable block.
sub infix:<+>(Foo $a, Foo $b) { $a.Int + $b.Int } # arity of "+" is 2
sub frobnicate($x) { ... } # arity of 1
sub the-answer() { 42 } # arity of 0
-> $key, $value { ... } # arity of 2
The arity of a Callable is one of the main selectors in multi-dispatch.
ASCII operator
The ASCII variant of a non-ASCII Unicode operator or
symbol.
For instance, (elem)
corresponds to the â
("Is this an element of
that set?") operator that comes from set theory. ASCII operators are a
workaround to the problem that people don't know how to type Unicode yet.
Culturally, while we encourage people to use the Unicode symbols in a
vague sort of way, we do not disparage the use of the
ASCII variants.
Well, maybe just a little...
Autothreading
Autothreading is what happens if you pass a Junction to a subroutine that expects a parameter of type Any or a subtype thereof (such as anything Cool). The call is then executed for each value of the junction. The result of these calls is assembled in a new junction of the same type as the original junction.
sub f($x) { 2 * $x };
say f(1|2|3) == 4; # OUTPUT: «any(False, True, False)â€Â»
Here f()
is a sub with one parameter, and since it has no explicit type,
it is implicitly typed as Any. The Junction argument causes the
f(1|2|3)
call to be internally executed as f(1)|f(2)|f(3)
, and the
resulting junction is 2|4|6
. These are then all compared to 4
,
resulting in a junction False|True|False
. This process of separating
junction arguments into multiple calls to a function is called
autothreading.
If you use the resulting junction in a Boolean context, such as with an
if
, it collapses into a single Boolean which is True
if any of the
values in the junction are True.
if f(1|2|3) == 4 { # fires because f(2) == 4 is true
say 'success';
}
Backtracking
Backtracking is the default way a regexp is matched. The engine is allowed to explore several ways moving backward in the string characters in order to allow every piece of a regexp to match something. For more information, see Regexp Backtracking section.
binder
When you pass an argument list to a function (or any other callable, like a method or a block), the argument list gets bound to the parameters in the signature. The code that does this is called the binder.
block
Blocks are code object with its own lexical scope, which allows them to define variables without interfering with other in the containing block.
bytecode
Although Raku looks like an interpreted language, since it uses the
#!
form to run its scripts (and they are called scripts), it is
actually
compiled to run in a virtual machine
so the compiler (currently Rakudo) generates
bytecode that runs either in
MoarVM or the Java Virtual Machine, the two VMs currently supported.
Camelia
A butterfly image intended primarily to represent Raku, The Language.
Colon pair and colon list
A colon pair is a shorthand syntax used to create or visually present a Pair object. The two most common forms are:
:a(4) # Same as "a" => 4, same as Pair.new("a", 4)
:a<4> # Same as "a" => "4", same as Pair.new("a", val("4"))
This is also known as the adverbial pair form.
Note: when the part after the colon and before the balanced delimiters is not a legal identifier, other semantics apply, not all of which produce Pair objects.
Two other common forms are:
:a # Same as :a(True)
:!a # Same as :a(False)
A colon list just means that a list that contains only colon pairs, does not need commas, or even spaces:
:a(4):c:!d:c # Same as a => 4, c => True, d => False, c => True
Finally, if there is a variable with the same name as an intended adverbial pair, you don't have to specify the name twice, but just specify the adverb with the appropriate sigil:
variable only | same as |
---|---|
:$foo | foo => $foo |
:@bar | bar => @bar |
:%mapper | mapper => %mapper |
:&test | test => &test |
See also Adverb.
Community
See https://raku.org/community/ for information about how to participate in the friendly Raku community.
Damian Conway
Original author of the Exegesis (among many other things). See also https://en.wikipedia.org/wiki/Damian_Conway.
decont
Short for "decontainerize", meaning to remove an item from its Scalar container|/language/containers, often to obtain a different behavior for items that have it.
diffy
See operator. It means the type of the operator result is sufficiently different from its arguments that op= makes little sense.
Exegesis
A document originally written by TheDamian, in which he tried to explain the Apocalypses to the common (wo)man. Now only kept as a historical document for reference. See also Synopsis.
Forward declarations
Declare the scope and/or type of a functional entity (class or routine) without actually declaring its code by using the "stub" operator; code will be declared later on in the same file.
grammar Quux {
my regex future {...};
say "foobarbaz" ~~ /<future>/;
regex future { f \w** 2 b \w ** 2 }
}
In this case, the regex acts as a method; please note that the scope is only declared once.
fiddly
Too complicated to apply a metaop to. See operator.
Handle
A handle is a data structure used to store information about some input/output operation such as file or socket reading or writing. Raku uses IO::Handle as a base class for filehandles, and IO::Socket for sockets.
Huffmanize
With reference to Huffman coding, "huffmanizing" is making things that are commonly used easier, and often shorter, to type. With things that are used less frequently it's both less of a bother to type longer pieces of code and often longer, more descriptive naming is necessary to easily be reminded of what the rarely-used feature does.
For example, printing output is a common task, while performing thread-safe atomic addition on native atomicity-safe integers is much less so. There's a need to "huffmanize" the task printing and that's why you can do it by just typing three letters put. But there's no need to "huffmanize" the rarely-needed atomic operators, which is why you type the lengthier names, such as atomic-inc-fetch. The name put is a bit vague, but because it's commonly used, it's easy to learn what it does. On the other hand, the name atomic-inc-fetch is rarer, and the more descriptive name helps recall its purpose better.
iffy
Often used as a Boolean value. See operator. Made via the use keyword.
import
Include functions from a module in the current namespace.
Instance
An instance of a class is also called an object in some other
programming languages. It has storage for attributes and is often the return
value of a call to a method called new
, or a literal.
Instances of most types are defined to be True
e.g.,
defined($instance)
is True
.
my Str $str = "hello"; ## this is with built-in types, e.g. Str
if defined($str) {
say "Oh, yeah. I'm defined.";
}
else {
say "No. Something off? ";
}
## if you wanted objects...
class A {
# nothing here for now.
}
my $an_instance = A.new;
say $an_instance.defined.raku;# defined($an_instance) works too.
To put things another way, a class contains the blueprints of methods and attributes, and an instance carries it into the real world.
Interface
An interface is an abstract class.
Invocant
Caller, the one who calls or invokes. The invocant of a method would be the object on which that method is being called, or, in some cases, the class itself. Invocant is used instead of caller because the latter refers to the scope.
IRC
Internet Relay Chat. Raku developers and users usually hang out on
the #raku
channel of irc.libera.chat
. This channel is also
populated by a host of friendly bots that allow you to interact with
Raku and its codebase, as well as send delayed messages and other
goodies. Check the full list in
the community page of raku.org.
IRC lingo
The following terms are often used on the Raku related IRC channels:
ALAP
As Late As Possible
autopun
A self-referencing pun, e.g. "Are you ignorant or apathetic?" - "I don't know, and I don't care."
backlog
That part of a discussion on an IRC channel that you've missed. If it is not or no longer available in your IRC client, you can go to sites such as https://irclogs.raku.org to see what has been logged for you.
Bot
A program that does automatic tasks on one or more IRC channels by acting like a regular user (as far as the IRC server is concerned) and performing some tasks that may involve answering to users requests. Examples can be found on the IRC page of raku.org.
Compilation unit or compunit|Reference,compunit (glossary);Reference,compilation unit
A compunit is a piece of Raku code that is analyzed and compiled as a single unit. Typically, this piece of code will be contained in a single file, but code inside an EVAL is also considered a compunit.
DWIM
Do What I Mean. A programming language designer motto. The opposite of a DWIM is a WAT.
flap
Sometimes a test will fail under some conditions, but not others; when this test passes in some test runs and fails in others, it's called flapping.
fossil
Something in a generally current document that is no longer true but which has not yet been fixed by correcting or removing it.
FSVO
For Some Value Of...
FTFY
Fixed That For You
gradual typing
You don't have to specify types of variables and parameters, but if you do, it helps in early determination of impossible dispatches and better optimization. See also https://en.wikipedia.org/wiki/Gradual_typing.
IIRC
If I Read (or Remember) Correctly.
IMHO
In My Humble Opinion.
IWBN
It Would Be Nice
LHF
Low Hanging Fruit. Usually used in the context of a (relatively) simple task to be performed by a (relative) newbie.
LGTM
Looks Good To Me
LTA
Less Than Awesome. Usually used in the context of an error message that is rather non-descriptive or unrelated to the actual error.
NST
No Such Thing
Opt
Short for "optimization", usually in either the context of spesh or JIT.
PB
Short for "problem". As in "that's not the pb".
PR
See Pull request.
P5
Perl 5
P6
Raku (née Perl 6)
RSN
Real Soon Now.
RT
Request Tracker (https://rt.perl.org/). The place where all the bugs related to Rakudo used to live. Nowadays, the Github issue tracker of the rakudo/rakudo repository is used for that.
TIMTOWTDI
An alternative form of TIMTOWTDI, explicitly including the "is" from the contraction "There's".
TMI
Too Much Information.
TMTOWTDI
"There's More Than One Way To Do It", the Perl motto.
UGT
"Universal Greeting Time" - i.e., it's always "morning".
WFM
Works For Me
WIP
Work In Progress
WP
Wikipedia
WW
Short for wrong window
. When on IRC, someone types something in
a channel that was intended for another channel, or for a private
message.
Larry Wall
Perl's benevolent dictator for life, among many other things. See also https://en.wikipedia.org/wiki/Larry_Wall.
Lexing
Performing lexical analysis, a step which usually precedes parsing.
Literal
A literal is a piece of code that directly stands for an (often built-in) object and also refers to the object itself.
my $x = 2; # the 2 is a literal
say $x; # $x is not a literal, but a variable
my $s = "Foo"; # the "Foo" is a literal, the $s is a variable
Different types of literals are described in the syntax document.
LHS
As an acronym left-hand side, it usually refers to the left hand side of
an expression, and more specifically to the left-hand side of
expressions such as $lhs = "this would be the right-hand side"
. Since
the left hand side of these expressions modify their value, when
something behaves as a LHS it means that it can be read and written to.
lvalue
An lvalue, or a left value, is anything that can appear on the
left-hand side of the assignment operator =
. It is anything you
can assign to.
Typical lvalues are variables, private and is rw
attributes, lists of
variables and lvalue subroutines.
Examples of lvalues:
Declaration | lvalue | Comments |
my $x; | $x | |
my ($a, $b); | ($a, $b) | |
has $!attribute; | $!attribute | Only inside classes |
has $.attrib is rw; | $.attrib | |
sub a is rw { $x }; | a() |
Examples of things that are not lvalues:
3 | literals |
constant x = 3; | constants |
has $.attrib; | attributes; you can only assign to $!attrib |
sub f { }; f(); | "normal" subs are not writable |
sub f($x) { $x = 3 }; | error - parameters are read-only by default |
These are typically called rvalues.
Mainline
The mainline
is the program text that is not part of any kind of block.
use v6.c; # mainline
sub f {
# not in mainline, in sub f
}
f(); # in mainline again
You can also have the mainline of any package-like declarator, such as class, module, grammar, etc. These are typically run just after the class/module/grammar have been compiled (or when loaded from a precompiled file).
Mayspec
Stands for "Maybe Specification". Usually refers to existing tests in the language specification. The speaker is indicating they did not check whether the test is a spectest or a propspec test; i.e., whether the test is included in a released language specification or is a new test, proposed for the next version of the spec.
MoarVM
MoarVM is short for Metamodel On A Runtime Virtual Machine. It's a virtual machine designed specifically for NQP and its MOP: 6model. A document about the purpose of MoarVM. MoarVM has some similarities with the Hotspot VM so you may peruse its glossary for entries missing from the present one.
Multi-dispatch
The mechanism used to invoke different routines (Methods or Subs) of the same name, selecting the correct one based on the Parameter prototype and the arguments it was called with.
The selection process is primarily based on types and number of arguments
(arity), where the narrowest, most specific candidate wins,
typically without regard to the order of declaration. The is default
trait may be used as a tie breaker in this first phase. There is also a
secondary phase where some different tie breakers may be evaluated in order
of declaration of the methods or subs.
multi-method
A method that has multiple candidates going by the same name and are subject to Multi-Dispatch.
NĂ©e
"Formerly known as".
NFG
Normal Form Grapheme is the way Raku implements graphemes, using a normal form in which strings with the same graphemes can be easily compared in constant time. More on that on these articles in 6guts and a fun explanation of how NFG works in this IRC log.
Niecza
An implementation of Raku targeting the .NET platform. No longer actively maintained.
Not Quite Perl
See NQP.
NQP
NQP is a primitive language for writing subroutines and methods using a subset of the Raku syntax. It's not intended to be a full-fledged programming language, nor does it provide a runtime environment beyond the basic VM primitives. Compilers (such as Rakudo) typically use NQP to compile action methods that convert a parse tree into its equivalent abstract syntax tree representation.
NYI
Not Yet Implemented
opcode
An opcode, or operation code, is a bytecode operation, that is, a command of the language actually used on the virtual machine. They are not usually intended for human consumption, but they are usually specified somewhere, like this document for MoarVM.
Operator
An expression is made of operators and operands. More precisely it is made
of an operator and operands that can be subexpressions or values.
Operators are an alternative syntax for a multi-method. With that
syntax, what would be the arguments of the function are named
operands instead. Operators are classified into
categories of
categories. A category has a precedence, an arity, and can be fiddly,
iffy, diffy. Raku is very creative as to what is an operator, so
there are many categories. Operators are made of many tokens, possibly with
a subexpression. For example, @a[0]
belongs to the postcircumfix
category, is broken into the operand @a
and the postcircumfix operator
[0]
where 0
is the postcircumfixed subexpression.
The <O(I<...>)>
construction gives information about an operator
that completes the information provided by its category. Below
%conditional
is the category, :reducecheck<ternary>
, which
specifies calling .ternary
to post-process the parse subtree
and :pasttype<if>
specifies the NQP opcode generated in the
AST from the parse subtree.
<O('%conditional, :reducecheck<ternary>, :pasttype<if>')>
Parse tree
A parse tree represents the structure of a string or sentence according to a grammar. Grammars in Raku output parse trees when they successfully match a string.
Parameter
Parameter is a class to define parameters to Subroutines, Methods and Callable blocks. As opposed to the arguments you specify when calling a subroutine/method/callable block.
sub foo($bar) { say $bar } # $bar is a parameter
foo(42); # 42 is an argument
Parrot
A virtual machine designed to run Raku and other dynamic languages. No longer actively maintained.
PAST
Parrot AST.
Perl
The Perl programming language.
Perl 6
The name used for Raku before October 2019.
PERL
A way to describe Perl as a language, considered to be improper by many in the Perl Community.
POD
Plain Ol' Documentation, a documentation format understood by Raku. See here for further information.
POV
Stands for "Proof Of Viability". To be included in the language specification, a "proof of viability" implementation of the feature must exist in at least one mostly-compliant Raku compiler.
Propspec
Stands for "Proposed Specification". Usually refers to existing tests in the language specification that are proposed for inclusion in the next release.
Pull request
A feature of GitHub and other git hosts like GitLab that allows you to make patches to be easily applied using the GitHub web user interface. It means you request someone to do a git pull from your repository to hers. PR is its usual acronym.
priming
Priming (sometimes called partial function
application in other
programming languages) is the act of creating a new function by providing some
but not all of the arguments to an existing function. For example, to create a
function that takes one argument and adds 42 to it, you could prime the addition
operator with 42
as a single argument: * + 42
. See
Whatever-priming and assuming.
property
In this context, it either refers to an object property, which is the value of an instance variable, or a Unicode property which are codepoint features that allow programs to identify what kind of entity they represent, that is, if they are a letter, or a number, or something completely different like a control character.
pugs
pugs was one of the first interpreters/compilers written for Raku. It was written in Haskell by Audrey Tang.
QAST
Successor to PAST ('Q' being the next letter after 'P').
Rakudo
Rakudo is the name of a Raku implementation that runs on MoarVM and
the JVM. It is an abbreviation of Rakuda-do
, which, when translated
from Japanese, means "The Way of the Camel". Also, in Japanese, "Rakudo"
means "Paradise."
Reify
In the English language, reify means "to convert into or regard as a concrete thing." Its meaning in Raku is very similar, in that conceptual things, like "elements of an infinite list", get reified when you try to operate on some of them. In general, reification means turning a potential element (be it an element in a lazy list that has not been computed yet or an element in a container that has not been extracted) into its actual value.
Repository
A filesystem under control of a source control management application, usually git, that holds the sources for a project, library or application. This file, for instance, is in a GitHub repository. Repositories store not only files, but also history of changes and can be used by the developing or writing team for interaction through issues or comments to code.
In Raku context, however, a repository is also a short name for
compilation unit repository and constitutes a system that locates and
loads modules, managing their installation and precompilation. They are
structured as linked lists, including chain of repositories ending in
the default Compunit::Repository::Installation
.
RHS
Acronym for Right-Hand Side, usually refers to the right-hand side of
assignment expressions such as my $bound := $rhs
.
roast
The Raku specification tests, which live here: https://github.com/Raku/roast/. Originally developed for pugs, it now serves all Raku implementations. Why roast? It's the repository of all spec tests.
Roles
Roles, mix-ins or traits define interfaces and/or implementation of those interfaces as well as instance variables using them, and are mixed-in when declaring classes that follow that interface. Abstract classes are particular examples of Roles where the actual implementation is deferred to the class that uses that Role.
Roles are part of Raku's object system, and are declared using the role keyword and used in class declaration via does.
rvalue
A value that can be used on the right-hand side of an assignment. See also lvalue.
SAP
Stands for "Specification APpendices". The SAP includes optional tests that implementations may choose to follow, but don't necessarily have to.
Can be used as a verb. To SAP something is to place it into Specification Appendices.
Semilist
A semilist is a semicolon-separated list like this one: 1;3;5
, and
is actually a list of lists, with each component of the semilist being a
slice of a particular dimension. @array[1;3;5]
would be equivalent to
@array[1][3][5]
.
Sigil
In Perl, the sigil is the first character of a variable name. It must be either $, @, %, or & respectively for a Scalar, Array, Hash, or Code variable. See also Twigil and role. Also sigiled variables allow short conventions for variable interpolation in a double quoted string, or even postcircumfix expressions starting with such a variable.
Sigilless variable
Sigilless variables
are actually aliases to the value it is assigned to them, since they are not
containers. Once you assign a sigilless variable (using the escape
\
), its value cannot be changed.
Spesh
A functionality of the MoarVM platform that uses runtime gathered data to improve commonly used pieces of bytecode. It is much like a JIT compiler, except that those usually output machine code rather than bytecode.
STD
STD.pm
is the "standard" Raku grammar definition (see
https://github.com/perl6/std/) that was used to implement Raku.
STD.pm is no longer really a "specification" in a proscriptive sense:
it's more of a guideline or model for Raku implementations to follow.
Stub
Stubs define name and signature of methods whose implementation is deferred to other classes.
role Canine {
method bark { ... } # the ... indicates a stub
}
Classes with stubs are Abstract classes.
Symbol
Fancy alternative way to denote a name. Generally used in the context of modules linking, be it in the OS level, or at the Raku virtual machine level for modules generated from languages targeting these VMs. The set of imported or exported symbols is called the symbol table.
Synopsis
The current human-readable description of the Raku language. Still in development. Much more a community effort than the Apocalypses and Exegeses were. The current state of the language is reflected by roast, its test suite, not the synopses where speculative material is not always so flagged or more recent additions have not been documented. This is even more true of material that has not been yet implemented.
Syntax analysis
A syntax or syntactic analysis is equivalent to parsing a string to generate its parse tree.
Test suite
The Raku test suite is roast.
TheDamian
IRC screen name for Damian Conway, writer of the original Exegeses.
TimToady
IRC screen name for Larry Wall, creator of Perl. The name comes from the pronunciation of TIMTOWTDI as a word.
token
In this context, a token is a regex that does not backtrack. In general, tokens are extracted from the source program while lexing.
Thunk
A piece of code that isn't immediately executed, but doesn't have an independent scope.
Tight and loose precedence
In this context, tight or tighter refers to
precedence rules
and is the opposite of looser
. Precedence rules for new terms are
always expressed in relationship with other terms, so is tighter
implies that operands with that operator will be grouped before operands
with the looser operator. Operators with
tight precedence
are grouped with priority to others and are generally tighter than most
others; loose
exactly the opposite,
so it is always convenient to be aware of the exact precedence of all
operators used in an expression.
Truthy and Falsy
A value is "truthy" if it evaluates to True
in Boolean context and "falsy"
if it evaluates to False
.
For example, a non-empty string is considered True
and an empty string
False
:
say so ""; # OUTPUT: «Falseâ€Â»
say so "non-empty"; # OUTPUT: «Trueâ€Â»
say "truthy" if "non-empty"; # OUTPUT: «truthyâ€Â»
while Numerics are considered True
when non-zero:
say so 0; # OUTPUT: «Falseâ€Â»
say so 1; # OUTPUT: «Trueâ€Â»
say so -1; # OUTPUT: «Trueâ€Â»
say "truthy" if -1; # OUTPUT: «truthyâ€Â»
say 0 || "falsy"; # OUTPUT: «falsyâ€Â»
twine
A data structure used to hold a POD string with embedded formatting codes. For example:
=begin pod
C<foo>
=end pod
say $=pod[0].contents[0].contents.raku;
The output will be:
["", Pod::FormattingCode.new(type => "C", meta => [], config => {}, contents => ["foo"]),""]
Type objects
A type object is an object that is used to represent a type or a class. Since in object oriented programming everything is an object, classes are objects too, and they inherit from Mu.
Type smiley
A
type smiley
is a suffix a type may have that indicates the definiteness of values
that can typecheck against it. This may be :D
to indicate that only
defined values can typecheck (i.e. instances), :U
to indicate that only
undefined values can typecheck (i.e. type objects), or :_
to indicate
that both defined and undefined values can typecheck. These resemble
emoticons, thus the name.
value
A value is what is actually contained in a container such as a variable. Used in expressions such as lvalue, to indicate that that particular container can be assigned to.
UB
Stands for "Undefined Behavior". In other words, it is something that is not explicitly specified by the language specification.
Value type
A type is known as a value type if it is immutable and any instance of that type is interchangeable with any other instance "of the same value"âthat is, any instance constructed in the same way. An instance of a value type is often called a value (but should not be confused with lvalues or rvalues).
For example, numbers are value types, so a number constructed one place
in your program with, for instance, the literal 3
can't be changed in
any wayâit simply is 3âand any later use of the literal 3
can
safely be pointed at the same place in memory as the first with no ill
consequences.
Classes doing the roles Numeric and Stringy are among a few examples of built-in value types.
A value type is created by ensuring that an instance of the value type is immutable (i.e., its attributes cannot be modified after construction) and that its WHICH method returns the same thing every time an instance with the same value is constructed (and conversely returns a different thing every time an instance with a different value is constructed).
The language is free to optimize based on the assumption that equivalent
instances of value types are interchangeable, but you should not depend
on any such optimization. For instance, if you want
clone to return an instance of self
, or you want
instance construction to be
memoized so that
re-construction of a previously-constructed value always returns the
same instance, you currently must override this behavior yourself.
(The same would hold true of object finalization, but if your instances need special destruction behavior, you almost certainly do not actually have a value type. Values should be thought of as "timeless" and existing in some ideal form outside of your program's memory, like natural values are.)
Variable
A variable is a name for a container.
Variable interpolation
The value of variables is interpolated into strings by simply inserting that variable into the string:
my $polation="polation";
say "inter$polation"; # OUTPUT: «interpolationâ€Â»
This might need curly braces in case it precedes some alphanumeric characters
my $inter="inter";
say "{$inter}polation"; # OUTPUT: «interpolationâ€Â»
Interpolation occurs in string context, so a valid stringification method must exist for the class. More general interpolation can be achieved using the double q quoting constructs.
Virtual machine
A virtual machine is the Raku compiler entity that executes the bytecode. It can optimize the bytecode or generate machine code Just in Time. Examples are MoarVM, Parrot (who are intended to run Raku) and more generic virtual machines such as JVM and Javascript.
WAT
The opposite of a DWIM; counter-intuitive behavior. It is said that to every DWIM there is a corresponding WAT. See also https://www.destroyallsoftware.com/talks/wat.
whitespace
A character or group of blank characters, used to separate words. An example is the space character « ».
6model
6model
is used in the MoarVM, and provides
primitives used to create an object system. It is described in
this presentation by Jonathan Worthington and implemented
here in MoarVM.
[1]The twine
is an array with an odd number of elements beginning
with a simple string, alternating with formatting code objects and
simple strings, and ending with a simple string; the formatting code
objects are intertwine
d with the strings. The strings may be empty
(as shown in the example). A twine with no formatting code will contain
one simple string.