Getting Started with EK9 · Appendix E

Glossary

Plain definitions of the terms used in this book. Where a term has a chapter of its own, that is where to go for the full story.

Absent / unset / set — the three states every EK9 value can be in. Set means it holds a meaningful value; unset means the object is there but has no meaningful value yet; absent means there is no object at all. EK9 code is designed never to see an absent value: the compiler checks that every variable has been given an object before it is read. An empty Optional is not absent — it is a real Optional object that is unset. EK9 has no null keyword.

Abstract — a type or method with no body, meant to be completed by another type. You cannot create an abstract type directly. The opposite is concrete.

Aggregate — a construct that defines a type with members of its own (fields, methods, operators): a record, class, trait or component, and, in the second volume, a service. A function is not an aggregate.

Capture list — the values a dynamic function or class holds on to when it is created, so it can use them later. It holds them by reference, not as copies (the second volume).

Class — a construct that hides its data (private fields) behind public methods.

Component — a construct that hides a whole implementation behind an interface, so the application can wire in the real one. Dependency injection uses components.

Concrete — a type complete enough to build: it supplies a body for every method it has. The opposite of abstract.

Constant — a named literal of a built-in type, declared in defines constant. Its value can never change: a function given a constant receives a copy.

Constrained type — a type built by narrowing another, for example an Integer that must be between 16 and 100. It reuses the base type's abilities but is not a subtype of it.

Constructor — the special method that builds a value of a type.

Coupling / cohesion — how tangled a type is with others (coupling) and how focused it is on one job (cohesion). EK9 measures both and enforces limits.

Coverage — how much of your code your tests actually exercise. EK9 measures it and requires a minimum.

Default operator — an operator the compiler can write for you, such as <=> or ?, because it is mechanical. Ask for one by name, or get the whole set with default operator.

Dependency injection (DI) — supplying a component the real implementation to use, rather than hard-wiring it. Lets you swap a real part for a test part (the second volume).

Dispatcher — EK9's safe way to run different code for different actual types, without casts (the second volume).

Enumeration — a type that is a fixed set of named values, declared in defines type, such as the days of the week. A value of it can only ever be one of those names, or unset.

Function — a named piece of behaviour that takes inputs and may return a result. It holds no state of its own.

Generic — a type written once and parameterised by another type, such as List of String.

Guard — a check attached to a statement that only lets it run when a value is set and passes a test.

Hash code (#?) — a whole number worked out from a value, which collections such as Dict use to find values quickly. Two values that are equal must have the same hash code.

Hexadecimal — counting in base 16, with the digits 0-9 then A-F. Character codes such as é are written in it.

Interpolation — building a string with values inside it, using backticks and ${...}.

Iterator — an object that hands out the items of a collection one at a time: hasNext() asks whether there is another, and next() takes it.

Literal — a value written directly in the code: 42, "Ada", 12#GBP, true.

Module — the named box a piece of EK9 code lives in (defines module ...).

Operator — a symbol such as +, == or <=> that a type can give meaning to. EK9 has a fixed set; you cannot invent new symbols, and each must keep its usual meaning.

Optional / Result — safe containers for "maybe a value" (Optional) and "a value or an error" (Result). The compiler makes you check them before use.

Panic — how an EK9 program stops at once when something that must be true is not, for example a failed require. It prints Panic: and the reason.

Parameter — a named input to a function or method, declared after ->.

Polymorphism — one name standing for several kinds of thing. Code written for a shared parent type, such as Shape, works with every subtype, and each value runs its own version of a method.

Program — an entry point you can run, the place your code meets the outside world.

Promotion (#^) — turning a value into a related type, producing a fresh independent copy.

Pure / purity — a promise about change: a pure function does not reassign its variables (apart from setting its result) and does not alter what it was handed. It may still print. The compiler checks it.

Record — a construct that carries data openly (public fields), with operators.

Representation exposure — the bug where a type hands out a reference to its own internals, so an outsider can change them. EK9's copy-at-the-boundary habit prevents it.

require (precondition) — a condition that must be true before a piece of code runs, such as require n?. If it is false, the program panics.

Sanitisation — checking text that comes in from outside, such as a line read from a file, and refusing content that could be harmful.

Stream / pipeline — processing a sequence of values through stages (cat | filter | map | collect), EK9's replacement for loops with break.

Subtype — a type that extends another (its parent), and can be used wherever the parent is expected.

Ternary — the one-line either/or, condition <- valueIfTrue : valueIfFalse.

Trait — a bundle of behaviour a class can adopt, letting behaviour cut across unrelated types. A trait holds no state of its own.

Type inference — the compiler working out a variable's type from the value it is given, as in age <- 36.

Unit test — a small test of one piece of behaviour. In EK9 testing is a first-class part of the language, not an add-on.

Variable — a name that refers to a value, declared with <- (or with as and a type).

<=> (the comparator) — the operator that says whether one value is less than, equal to, or greater than another. Most other comparisons are built from it.

? (the set check) — asks whether a value is set.