Glossary

Glossary of Perl 6 terminology

Abstract Class

The generic Computer Science term "abstract class" defines the interface or API of a class. In Perl 6, 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 Perl 6, a yearly set of blog posts for each day from the 1st until the 25th of December, to be found at https://perl6advent.wordpress.com.

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 also 

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, like:

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 quoted string:

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␤» 

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 implementation.

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 an 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 $aFoo $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.

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';
    }

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

bytecode

Camelia

A butterfly image intended primarily to represent Perl 6, 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", "4") 

This is also known as the adverbial pair form. Note: when the part after the colon and before the brackets 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:

:$foo          # same as foo => $foo 
:@bar          # same as bar => @bar 
:%mapper       # same as mapper => %mapper 
:&test         # same as test => &test 

See also Adverb.

Community Community

See https://perl6.org/community/ for information about how to participate in the friendly Perl 6 community.

Damian Conway

Original author of the Exegesis (among many other things). See also https://en.wikipedia.org/wiki/Damian_Conway.

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 an historical document for reference. See also Synopsis.

fiddly

Too complicated to apply a meta-op to. See operator.

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. put is a bit of a vague name, but because it's commonly used, it's easy to learn what it does. atomic-inc-fetch, on the other hand is rarer, and the more descriptive name helps recall its purpose better.

iffy

Often used as a boolean value. See operator.

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 builtin 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.perl;# 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.

IRC

Internet Relay Chat. Perl 6 developers and users usually hang out on the #perl6 channel of irc.freenode.org. Currently available bots are:

camelia

The Bot on the #perl6 IRC channel that evaluates code, e.g.:

[16:28:27]  <lizmat>  m: say "Hello world"
[16:28:28]  <+camelia>    rakudo-moar 812a48: OUTPUT«Hello world␤»

This is a handy tool for showing people if the output is (un)expected.

dalek

The Bot on the #perl6 IRC channel that reports changes made to various Perl 6 related repositories.

[15:46:40] <+dalek> doc: 2819f25 | lizmat++ | doc/Language/glossary.pod:
[15:46:40] <+dalek> doc: Add stubs for stuff inside the glossary already
[15:46:40] <+dalek> doc: review: https://github.com/perl6/doc/commit/2819f250

yoleaux

The Bot on the #perl6 IRC channel that provides various services to people logged in. Commands to yoleaux (a pun on YOLO) start with a period. Some often used commands are:

.tell

Leave a message to another user who is currently not logged in. The message will be relayed as soon as the user says anything on the channel.

.tell lizmat I've read the glossary

.u

Look up unicode codepoint information from either a codepoint, or the name of a codepoint.

[16:35:44]  <lizmat>   .u empty set
[16:35:45]  <yoleaux>  U+2205 EMPTY SET [Sm] (∅)
[16:36:29]  <lizmat>   .u ∅
[16:36:30]  <yoleaux>  U+2205 EMPTY SET [Sm] (∅)

Some IRC clients then easily allow you to copy/paste the codepoint in question, which can be sometimes be easier than other unicode codepoint input methods.

IRC Lingo

The following terms are often used on the Perl 6 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 http://irc.perl6.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 are camelia, dalek and yoleaux.

DWIM

Do What I Mean. A programming language designer motto.

flap

Sometimes a test will fail under some conditions, but not others; when this test passes some test runs and fails 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

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.

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".

PBP

"Perl Best Practices". The book by Damian Conway outlining best practices when programming Perl 5.

PR

See Pull Request.

P5

Perl 5

P6

Perl 6

RSN

Real Soon Now

RT

Request Tracker (http://rt.perl.org/). The place where all the bugs related to Rakudo live.

TIMTOWTDI

An alternative form of TMTOWTDI, 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

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 

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 pre-compiled file).

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 process of picking a candidate for calling of a set of methods or subs that come by the same name but with different arguments. The most narrow candidate wins. In case of an ambiguity, a routine with is default trait will be chosen if one exists, otherwise an exception is thrown.

multi-method

A method that has multiple candidates going by the same name and are subject to Multi-Dispatch.

Niecza

An implementation of Perl 6 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 Perl 6 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

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. Perl 6 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

Parameter

Parameter is a class to define parameters to subroutines, method and a 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 Perl 6 and other dynamic languages. No longer actively maintained.

PAST

Parrot AST.

perl

Name of the Perl 5 executor.

Perl

The Perl programming language in its many forms.

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 Perl 6. See S26 for details.

Pull Request

A feature of https://github.com that allows you to make patches to be easily applied using the Github user interface. It means you request someone to do a git pull from your repository to hers. In GitHub, it can be done automatically through the web interface. PR is its usual acronym.

pugs

pugs was one of the first interpreters/compilers written for Perl 6. 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 Perl 6 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 English language, reify means to "to convert into or regard as a concrete thing." Its meaning in Perl 6 is very similar, in that conceptual things, like "elements of an infinite list" get reified when you try to operate on some of them:

# A list containing infinite number of un-reified Fibonacci numbers: 
my @fibonacci = 11* + * … ∞;
 
# We reify 10 of them, looking up the first 10 of them with array index: 
say @fibonacci[^10]; # OUTPUT: «(1 1 2 3 5 8 13 21 34 55)␤» 
 
# We reify 5 more: 10 we already reified on previous line, and we need to 
# reify 5 more to get the 15th element at index 14. Even though we need only 
# the 15th element, the original Seq still has to reify all previous elements: 
say @fibonacci[14]; # OUTPUT: «987␤» 

Above we were reifying a Seq we created with the sequence operator, but other things use the concept as well. For example, an un-reified Range is just the two end points. In some languages, calculating the sum of a huge range is a lengthy and memory-consuming process, but Perl 6 calculates it instantly:

say sum 1 ..9_999_999_999_999# OUTPUT: «49999999999995000000000000␤» 

Why? Because the sum can be calculated without reifying the Range; that is without figuring out all the elements it contains. This is why this feature exists. You can even make your own things you can reify-on-demand, using gather and take:

my $seq = gather {
    say "About to make 1st element"take 1;
    say "About to make 2nd element"take 2;
}
say "Let's reify an element!";
say $seq[0];
say "Let's reify more!";
say $seq[1];
say "Both are reified now!";
say $seq[^2];
 
# OUTPUT: 
# Let's reify an element! 
# About to make 1st element 
# 1 
# Let's reify more! 
# About to make 2nd element 
# 2 
# Both are reified now! 
# (1 2) 

Following the output above, you can see the print statements inside the gather got printed only when we reified the individual elements while looking up an element. Also note, the elements got reified just once. When we printed the same elements again on the last line of the example, the messages inside gather we no longer printed. This is because the construct used already-reified elements from the Seq's cache.

Note that above we assigned the gather to a Scalar container (the $ sigil), not the Positional one (the @ sigil). The reason is that the @-sigiled variables are mostly lazy. What this means is they reify the stuff assigned to them right away most of the time. The only time they don't do it is when the items are known to be is-lazy, like our sequence generated with infinity as the end point. Were we to assign the gather to a @-variable, the say statements inside of it would've been printed right away.

Another way to fully-reify a list, is by calling .elems on it. This is the reason why checking whether a list contains any items is best done by using .Bool method (or just using if @array { … }), since you don't need to reify all the elements to find out if there are any of them.

There are times where you do want to fully-reify a list before doing something. For example, the IO::Handle.lines returns a Seq. The following code contains a bug; keeping reification in mind, try to spot it:

    my $fh = "/tmp/bar".IO.open;
    my $lines = $fh.lines;
    close $fh;
    say $lines[0];

We open a file handle, then assign return of .lines to a Scalar variable, so the returned Seq does not get reified right away. We then close the file handle, and try to print an element from $lines.

The bug in the code is by the time we reify the $lines Seq on the last line, we've already closed the file handle. When the Seq's iterator tries to generate the item we've requested, it results in the error about attempting to read from a closed handle. So, to fix the bug we can either assign to a @-sigiled variable or call .elems on $lines before closing the handle:

    my $fh = "/tmp/bar".IO.open;
    my @lines = $fh.lines;
    close $fh;
    say @lines[0]; # no problem! 

Also good:

    my $fh = "/tmp/bar".IO.open;
    my $lines = $fh.lines;
    say "Read $lines.elems() lines"#reifying before closing handle 
    close $fh;
    say $lines[0]; # no problem! 

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.

roast

The Perl 6 specification tests, which live here: https://github.com/perl6/roast/. Originally developed for pugs, it now serves all Perl 6 implementations. Why roast? It's the repository of all spec tests.

rule

(Used in regular expressions)

rvalue

A value that can be used on the right hand side of an assignment. See also lvalue.

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

Spesh

A functionality of the MoarVM platform that uses run-time 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" Perl 6 grammar definition, see https://github.com/perl6/std/ that was used to implement Perl 6. STD.pm is no longer really a "specification" in a proscriptive sense: it's more of a guideline or model for Perl 6 implementations to follow.

Stub

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 Perl 6 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 Perl 6 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

test suite

The Perl 6 test suite is roast

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...

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.

Thunk

A piece of code that isn't immediately executed, but doesn't have an independent scope.

value

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

Virtual Machine

A virtual machine is the Perl 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 Perl 6) and more generic virtual machines such as JVM and Javascript.

whitespace

6model