Appendix H: Glossary

This glossary defines over 200 key terms used throughout Programming with Pascal. Each entry includes the chapter where the term is first introduced or most thoroughly explained. Terms are listed alphabetically. Cross-references point to related entries.


A

Abstract class — A class that contains one or more abstract methods and therefore cannot be instantiated directly. It serves as a blueprint for descendant classes, which must provide concrete implementations of all abstract methods. See also abstract method, virtual method. (Ch. 18)

Abstract method — A method declared with the abstract keyword that has no implementation in its declaring class. Any class with an abstract method is itself abstract. Descendant classes must override the method and provide an implementation. (Ch. 18)

Accumulator — A variable used inside a loop to gradually build up a result, such as a running total or a concatenated string. The accumulator must be initialized before the loop begins. (Ch. 6)

Actual parameter — The value, variable, or expression passed to a subprogram at the point of a call. Contrasted with formal parameter, which is the placeholder declared in the subprogram's header. Also called an argument. (Ch. 7)

Algorithm — A finite, well-defined sequence of steps that solves a problem or computes a result. Algorithms are independent of any particular programming language. See also complexity analysis. (Ch. 1)

Ancestor class — A class from which another class inherits, directly or indirectly. In Object Pascal, all classes ultimately descend from TObject. Also called a superclass or parent class. (Ch. 17)

AnsiString — The default string type in Free Pascal when {$H+} is active. AnsiStrings are reference-counted, dynamically allocated, and have no practical length limit. Contrasted with ShortString. (Ch. 10)

Append — A file-opening mode that positions the file pointer at the end of an existing text file, so that subsequent Write and WriteLn calls add data after the existing content rather than overwriting it. (Ch. 13)

Argument — See actual parameter. (Ch. 7)

Array — A fixed-size, contiguous collection of elements that are all the same type, accessed by an integer index. Pascal arrays can have arbitrary lower and upper bounds (e.g., array[1..100] or array[-5..5]). See also dynamic array, multidimensional array. (Ch. 9)

ASCII — American Standard Code for Information Interchange. A character encoding that assigns a numeric value (0-127) to each character. In Pascal, Ord returns the ASCII code of a Char, and Chr converts a code back to a Char. (Ch. 3)

Assignment — The act of storing a value in a variable. Pascal uses := as the assignment operator, distinguishing it from = which is used exclusively for equality comparison. (Ch. 3)

Assignment compatibility — The compiler's rules governing which types can be assigned to which variables. In Pascal, assignment compatibility is stricter than in many other languages, preventing accidental type mixing. (Ch. 3)


B

Base case — The terminating condition in a recursive function that returns a result directly without making another recursive call. Every correct recursive function must have at least one base case. See also recursion. (Ch. 22)

Big O notation — A mathematical notation that describes the upper bound of an algorithm's growth rate as input size increases. Written as O(f(n)), where f(n) is a function of the input size. Examples: O(1), O(log n), O(n), O(n log n), O(n^2). (Ch. 26)

Binary file — A file that stores data in its raw binary representation rather than as human-readable text. Binary files preserve exact numeric precision and are typically smaller and faster to read/write than text files, but cannot be opened in a text editor. (Ch. 13)

Binary search — A search algorithm that works on sorted data by repeatedly dividing the search space in half. Each comparison eliminates half of the remaining elements. Time complexity: O(log n). See also linear search. (Ch. 23)

Binary tree — A tree data structure in which each node has at most two children, called the left child and the right child. See also binary search tree, tree traversal. (Ch. 24)

Binary search tree (BST) — A binary tree in which every node's left subtree contains only values less than the node, and every node's right subtree contains only values greater than the node. This property allows O(log n) search, insertion, and deletion on average. (Ch. 24)

Block — A section of code delimited by begin and end. In Pascal, a block groups multiple statements into a single compound statement. Blocks can be nested. (Ch. 3)

Boolean — A data type with exactly two values: True and False. Named after George Boole. Pascal's Boolean type is an ordinal type where Ord(False) = 0 and Ord(True) = 1. (Ch. 3)

Boolean short-circuit evaluation — An optimization where the second operand of and or or is not evaluated if the result can be determined from the first operand alone. Enabled by {$B-} in Free Pascal (the default). See also complete Boolean evaluation. (Ch. 5)

Bubble sort — A simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. Time complexity: O(n^2). Rarely used in practice but valuable as a teaching tool. (Ch. 23)

Buffer — A temporary storage area in memory used to hold data during input/output operations. File I/O in Pascal is buffered: data is accumulated in a buffer and written to disk in larger chunks for efficiency. (Ch. 13)

Bug — An error in a program that causes incorrect behavior. The term originated from an actual moth found in a relay of the Harvard Mark II computer in 1947. See also debugging. (Ch. 2)


C

Call stack — A region of memory that stores information about active subprogram calls. Each call pushes a stack frame containing local variables, parameters, and the return address. When a subprogram returns, its frame is popped. See also stack overflow. (Ch. 8)

Canvas — In Lazarus, the drawing surface of a visual component. The TCanvas object provides methods like LineTo, Rectangle, Ellipse, TextOut, and DrawArc for custom 2D graphics rendering. (Ch. 30)

Case statement — A multi-way selection statement that branches execution based on the value of an ordinal expression (the selector). Pascal's case statement supports individual values, ranges, and comma-separated lists. The else clause handles unmatched values. (Ch. 5)

Char — A data type representing a single character. In Pascal, Char literals are enclosed in single quotes (e.g., 'A'). The Char type is ordinal, so you can use Ord, Chr, Succ, and Pred with it. (Ch. 3)

Circular reference — A situation where Unit A's interface depends on Unit B and Unit B's interface depends on Unit A, creating a cycle that the compiler cannot resolve. Resolved by moving one dependency to the implementation uses clause or by extracting shared types into a third unit. (Ch. 33)

Class — A user-defined type that bundles data (fields) and behavior (methods) into a single entity. In Object Pascal, classes are reference types allocated on the heap. See also object, instance. (Ch. 16)

Class helper — A Free Pascal construct that allows adding methods to an existing class without inheritance or modifying the original source. Declared with class helper for TExistingClass. (Ch. 21)

Cohesion — A measure of how closely related the responsibilities within a single module (unit, class, or function) are. High cohesion means the module does one thing well. See also coupling. (Ch. 33)

Compiler — A program that translates source code into machine code (or intermediate code) before execution. Free Pascal is a native-code compiler that produces executable binaries directly. Contrasted with interpreter. (Ch. 1)

Compiler directive — A special instruction to the compiler embedded in source code using the {$...}` syntax. Common directives include `{$mode objfpc} (Object Free Pascal mode), {$H+}` (long strings), `{$R+} (range checking), and {$I-} (I/O checking off). (Ch. 2)

Complete Boolean evaluation — A mode where both operands of and and or are always evaluated, regardless of whether the result is already determined. Enabled by {$B+}. Contrasted with short-circuit evaluation. (Ch. 5)

Complexity analysis — The study of how an algorithm's resource consumption (time or space) grows as input size increases. See also Big O notation, time complexity, space complexity. (Ch. 26)

Component — In Lazarus, a reusable visual or non-visual element that can be placed on a form. Visual components (buttons, labels, edit boxes) appear on screen; non-visual components (timers, database connections) provide functionality without a visible representation. (Ch. 27)

Compound statement — A begin..end block that groups multiple statements into a single statement. Required whenever a control structure governs more than one statement. (Ch. 5)

Concatenation — Joining two strings end-to-end. In Pascal, the + operator concatenates strings. The Concat function provides an alternative. (Ch. 10)

Constant — A named value declared with const that cannot be changed during program execution. Constants improve readability, maintainability, and safety by preventing accidental modification. (Ch. 3)

Constructor — A special method (named Create by convention in Object Pascal) that initializes a new instance of a class. Constructors allocate heap memory for the object and set fields to their initial values. See also destructor. (Ch. 16)

Coupling — A measure of how much one module depends on another. Low coupling means modules interact through narrow, well-defined interfaces. See also cohesion. (Ch. 33)

Critical section — A synchronization primitive that allows only one thread at a time to execute a protected block of code. Used to prevent race conditions when multiple threads access shared data. In Free Pascal, implemented via TCriticalSection or EnterCriticalSection/LeaveCriticalSection. (Ch. 36)

Cross-platform — The ability of a program to run on multiple operating systems (Windows, macOS, Linux) without modification. Lazarus and Free Pascal support cross-platform development through the LCL's widgetset architecture. (Ch. 32)

CSV — Comma-Separated Values. A plain-text file format where each line represents a record and fields within a line are separated by commas. Despite its apparent simplicity, correct CSV parsing must handle quoted fields, embedded commas, and escaped quotes. (Ch. 34)


D

Dangling pointer — A pointer that references memory that has already been freed. Accessing data through a dangling pointer causes undefined behavior — the program may crash, return garbage, or appear to work correctly while silently corrupting data. (Ch. 14)

Data structure — An organized way of storing and accessing data. Pascal's built-in data structures include arrays, records, sets, strings, and files. Dynamic data structures such as linked lists, stacks, queues, and trees are built using pointers. (Ch. 9)

Database — A structured collection of data managed by a database management system. Chapter 31 covers SQLite databases accessed through the SQLdb components in Lazarus. (Ch. 31)

Deadlock — A situation in concurrent programming where two or more threads are each waiting for the other to release a resource, so none can proceed. One of the classic problems of multithreaded programming. (Ch. 36)

Debugging — The process of finding and fixing errors (bugs) in a program. Techniques include inserting WriteLn statements, using the Lazarus integrated debugger, and systematic reasoning about program state. (Ch. 2)

Declaration — A statement that introduces a name (identifier) and associates it with a type, value, or subprogram. In Pascal, all identifiers must be declared before they are used. See also definition. (Ch. 3)

Delphi — A commercial IDE and compiler for Object Pascal, originally developed by Borland and now maintained by Embarcadero Technologies. Anders Hejlsberg created the first version. Delphi and Free Pascal share most of the Object Pascal language but have some dialect differences. (Ch. 1)

Dependency injection — A design technique where an object receives its dependencies (typically via interfaces) from the outside rather than creating them internally. This promotes loose coupling and testability. (Ch. 18)

Descendant class — A class that inherits from another class. Also called a subclass or child class. See also ancestor class. (Ch. 17)

Destructor — A special method (named Destroy by convention in Object Pascal) that performs cleanup when an object is being freed. Destructors release resources such as memory, file handles, and database connections. Always declared as override and always call inherited Destroy. See also constructor. (Ch. 16)

Divide and conquer — An algorithm design strategy that breaks a problem into smaller subproblems, solves each subproblem recursively, then combines the solutions. Merge sort and quicksort are classic examples. (Ch. 25)

div — Pascal's integer division operator. Returns the quotient with any fractional part discarded. For example, 7 div 2 evaluates to 3. Contrasted with /, which returns a Real result. (Ch. 3)

DLL — Dynamic Link Library. A file containing compiled code that can be loaded by a program at runtime rather than being statically linked into the executable. On Linux, the equivalent is a shared object (.so). (Ch. 33)

downto — A keyword used in for loops when the loop variable should decrease rather than increase. Example: for i := 10 downto 1 do. (Ch. 6)

Dynamic array — An array whose size is determined at runtime using SetLength. Dynamic arrays are zero-indexed and allocated on the heap. Contrasted with static array, which has a fixed size determined at compile time. (Ch. 9)

Dynamic dispatch — See virtual method dispatch. (Ch. 17)

Dynamic memory — Memory allocated on the heap at runtime, as opposed to memory allocated on the stack at compile time. In Pascal, New and Dispose manage dynamic memory for pointer types; GetMem and FreeMem provide untyped allocation. See also heap, stack. (Ch. 14)


E

Encapsulation — The OOP principle of bundling data and the methods that operate on that data into a single unit (class), while restricting direct access to the data through visibility specifiers (private, protected, public). This protects internal state from external corruption. (Ch. 16)

Enumerated type — A user-defined ordinal type that lists all possible values by name. Example: type TColor = (Red, Green, Blue). Enumerated types improve readability and provide compile-time checking. (Ch. 12)

Eof — End-of-file. A Boolean function that returns True when the file pointer is past the last element. Used to control loops that read all data from a file. (Ch. 13)

Event — In GUI programming, a notification that something has occurred — a button was clicked, a key was pressed, a form was resized. Events are handled by event handlers, which are methods assigned to event properties. (Ch. 27)

Event-driven programming — A programming paradigm where program flow is determined by events (user actions, messages, sensor inputs) rather than by a predetermined sequence of instructions. Lazarus applications are event-driven. (Ch. 27)

Event handler — A procedure or method that executes in response to a specific event. In Lazarus, event handlers are connected to components through the Object Inspector or through code. Example: procedure TForm1.Button1Click(Sender: TObject). (Ch. 27)

Exception — An object that represents an error condition encountered during program execution. Exceptions disrupt normal flow and propagate up the call stack until caught by a try..except block. All exceptions in Object Pascal descend from the Exception class. (Ch. 19)

Expression — A combination of values, variables, operators, and function calls that evaluates to a single value. Examples: x + 5, Length(name) > 0, (a > b) and (c < d). (Ch. 3)


F

FIFO — First In, First Out. The access pattern of a queue: elements are removed in the same order they were added. See also LIFO, queue. (Ch. 15)

Field — A named data member within a record or class. Each field has a type and occupies a specific position in the record's memory layout. (Ch. 11)

File — A named collection of data stored on a secondary storage device (disk). Pascal supports three kinds of files: text files (TextFile), typed files (file of T), and untyped files (file). (Ch. 13)

for loop — A counted loop that executes a fixed number of times. The loop variable is automatically incremented (with to) or decremented (with downto) after each iteration. The loop variable must be an ordinal type and must not be modified within the loop body. (Ch. 6)

Formal parameter — The placeholder variable declared in a subprogram's header that receives a value when the subprogram is called. Contrasted with actual parameter. (Ch. 7)

Form — In Lazarus, the visual window that serves as the foundation for a GUI application. A form is an instance of TForm and contains components arranged visually in the form designer. (Ch. 27)

Forward declaration — A declaration that announces the existence of a subprogram before its full implementation appears. Necessary for mutual recursion, where two subprograms call each other. Uses the forward keyword. (Ch. 22)

Free — A method inherited from TObject that safely destroys an object by first checking if the reference is nil (avoiding a crash) and then calling Destroy. Always use Free instead of calling Destroy directly. (Ch. 16)

Free Pascal (FPC) — An open-source, cross-platform Pascal compiler that supports multiple dialects (Turbo Pascal, Delphi, ObjFPC). It produces native compiled executables for dozens of CPU architectures and operating systems. (Ch. 1)

FreeAndNil — A procedure from SysUtils that frees an object and sets the reference variable to nil in a single atomic operation, preventing dangling reference bugs. (Ch. 16)

Function — A subprogram that returns a value. Declared with the function keyword. Functions can be used in expressions wherever a value of their return type is expected. Contrasted with procedure. (Ch. 7)


G

Generics — A language feature that allows types and algorithms to be parameterized by other types. A generic class or function is written once and works with any type that satisfies its constraints. In Free Pascal, declared with generic keyword or specialize syntax. (Ch. 20)

Global variable — A variable declared in the main program block, accessible from all subprograms. Global variables should be used sparingly because they create hidden dependencies and make programs harder to understand and test. (Ch. 8)

Graph — A data structure consisting of vertices (nodes) connected by edges. Graphs can be directed or undirected, weighted or unweighted. Represented in code using adjacency matrices or adjacency lists. (Ch. 24)

Greedy algorithm — An algorithm design strategy that makes the locally optimal choice at each step, hoping to find a global optimum. Greedy algorithms do not always produce optimal solutions but are often simple and efficient. Examples: coin change, activity selection. (Ch. 25)

GUI — Graphical User Interface. A visual interface that allows users to interact with a program through windows, buttons, menus, and other visual controls, as opposed to a text-based command-line interface. (Ch. 27)

GUID — Globally Unique Identifier. A 128-bit value used to uniquely identify interfaces in Object Pascal. Required for interface querying and type casting with Supports(). Generated in Lazarus with Ctrl+Shift+G. (Ch. 18)


H

Hash table — A data structure that stores key-value pairs and provides near-O(1) average time for insertion, deletion, and lookup by computing a hash of the key to determine storage location. (Ch. 24)

Head pointer — A pointer to the first node in a linked list. All operations that traverse the list begin at the head. Inserting at the head is O(1). (Ch. 15)

Heap — The region of memory used for dynamic allocation. Memory on the heap persists until explicitly freed (or until the program ends). Contrasted with the stack, where memory is automatically managed. In Pascal, New/Dispose and GetMem/FreeMem manage heap memory. (Ch. 14)


I

IDE — Integrated Development Environment. A software application that combines a code editor, compiler, debugger, and other tools into a single interface. Lazarus is the IDE for Free Pascal development. (Ch. 2)

Identifier — A name given to a program element (variable, constant, type, procedure, function, unit, or program). Pascal identifiers must begin with a letter or underscore and can contain letters, digits, and underscores. Pascal identifiers are case-insensitive. (Ch. 3)

if..then..else — Pascal's conditional statement for two-way branching. The else clause is optional. The dangling else ambiguity is resolved by associating else with the nearest preceding then. (Ch. 5)

Immutable — A value or object that cannot be changed after creation. Pascal's const parameters provide a form of immutability for subprogram arguments. (Ch. 8)

Implementation section — The second section of a Pascal unit (after the interface section), containing the bodies of all public subprograms as well as any private types, variables, and helper routines invisible to other units. (Ch. 33)

in operator — An operator that tests membership of a value in a set. Returns True if the value is present in the set. Example: if ch in ['a'..'z'] then. (Ch. 12)

Index — An integer value used to access a specific element in an array. In Pascal, array indices can start at any integer value, not just 0. Out-of-bounds access is detected at runtime when range checking ({$R+}) is enabled. (Ch. 9)

Infinite loop — A loop that never terminates because its exit condition is never satisfied. Often caused by forgetting to update the loop variable or by an incorrect termination condition. (Ch. 6)

Information hiding — The principle of concealing implementation details behind a public interface. In Pascal, achieved through unit structure (interface vs. implementation sections) and visibility specifiers in classes (private, protected, public, published). (Ch. 16)

Inheritance — The OOP mechanism by which a new class (descendant) acquires the fields, methods, and properties of an existing class (ancestor). Inheritance models the "is-a" relationship. See also polymorphism. (Ch. 17)

Initialization section — An optional section at the end of a Pascal unit, executed automatically when the program starts. Used for one-time setup such as initializing global data, registering classes, or opening resources. See also finalization section. (Ch. 33)

Insertion sort — A sorting algorithm that builds the sorted portion one element at a time by inserting each new element into its correct position among the already-sorted elements. Time complexity: O(n^2) worst case, O(n) best case (nearly sorted data). Efficient for small arrays. (Ch. 23)

Instance — A specific object created from a class. Each instance has its own copy of the class's fields. Also called an object. (Ch. 16)

Integer — A whole number data type (no fractional part). Free Pascal provides several integer types of varying sizes: Byte (0-255), ShortInt (-128..127), Word (0-65535), SmallInt, Integer (typically 32-bit), LongInt, Int64, and QWord. (Ch. 3)

Interface (language construct) — A type that defines a contract of methods (and optionally properties) that implementing classes must provide. Unlike classes, interfaces support multiple implementation: a class can implement multiple interfaces. See also GUID. (Ch. 18)

Interface section — The first section of a Pascal unit, declaring all public types, constants, variables, and subprogram signatures that are visible to other units that use this unit. (Ch. 33)

Interpreter — A program that executes source code line by line without first compiling it to machine code. Python and JavaScript are interpreted languages. Contrasted with compiler. (Ch. 1)

Invariant — A condition that must always be true at a specific point in a program. Loop invariants must hold before and after each iteration. Class invariants are conditions that constructor, methods, and properties must maintain. (Ch. 6)

IOResult — A function that returns the status code of the last I/O operation when I/O checking is disabled ({$I-}). Returns 0 on success and a nonzero error code on failure. Must be called immediately after the I/O operation. (Ch. 13)


J

JSON — JavaScript Object Notation. A lightweight text-based data interchange format using key-value pairs and arrays. In Free Pascal, the fpjson and jsonparser units provide JSON reading and writing capabilities. (Ch. 34)


K

Keyword — See reserved word. (Ch. 3)


L

Lazarus — An open-source IDE for Free Pascal that provides a visual form designer, integrated debugger, and component library (LCL) for building cross-platform GUI applications. Lazarus is the free/open-source counterpart to Delphi. (Ch. 2)

LCL — Lazarus Component Library. The cross-platform component framework used by Lazarus, analogous to Delphi's VCL. The LCL provides a unified API that maps to platform-native widgets through widgetsets. (Ch. 27)

LIFO — Last In, First Out. The access pattern of a stack: the most recently added element is the first to be removed. See also FIFO, stack. (Ch. 15)

Linear search — A search algorithm that examines each element of a collection sequentially until the target is found or the end is reached. Time complexity: O(n). Works on unsorted data. See also binary search. (Ch. 23)

Linked list — A dynamic data structure where each element (node) contains a data value and one or more pointers to other nodes. Linked lists allow O(1) insertion and deletion at known positions but require O(n) for search. (Ch. 15)

Liskov Substitution Principle (LSP) — A principle stating that any instance of a descendant class must be usable wherever an instance of the ancestor class is expected, without breaking the program's correctness. Violations of LSP indicate flawed inheritance hierarchies. (Ch. 17)

Local variable — A variable declared inside a subprogram, accessible only within that subprogram. Local variables are allocated on the stack when the subprogram is called and deallocated when it returns. (Ch. 7)

Loop — A control structure that repeats a block of code. Pascal provides three loop constructs: for..to/downto..do (counted), while..do (pre-test), and repeat..until (post-test). (Ch. 6)


M

Magic number — (1) In file formats, a fixed sequence of bytes at the beginning of a file that identifies the file type. (2) In code, a numeric literal used without explanation, considered bad practice because it harms readability. Use named constants instead. (Ch. 34, Ch. 3)

Memory leak — A bug where dynamically allocated memory is never freed, causing the program's memory usage to grow over time. In Pascal, every New must have a corresponding Dispose, and every Create must have a corresponding Free. (Ch. 14)

Merge sort — A divide-and-conquer sorting algorithm that splits an array in half, recursively sorts each half, and merges the sorted halves. Time complexity: O(n log n) in all cases. Requires O(n) extra space. Merge sort is stable. (Ch. 23)

Message loop — The central loop in a GUI application that retrieves events from the operating system's message queue and dispatches them to the appropriate handlers. In Lazarus, Application.Run starts the message loop. (Ch. 27)

Method — A procedure or function that is a member of a class. Methods can access the class's fields and other methods through the implicit Self parameter. (Ch. 16)

mod — Pascal's modulus (remainder) operator. Returns the remainder of integer division. For example, 7 mod 3 evaluates to 1. Useful for determining divisibility, wrapping values, and extracting digits. (Ch. 3)

Modular design — The practice of dividing a program into self-contained units (modules), each with a clear interface and a single responsibility. In Pascal, units are the primary mechanism for modular design. (Ch. 33)

Multidimensional array — An array with more than one index dimension. A 2D array array[1..R, 1..C] represents a grid of R rows and C columns. Also declared as arrays of arrays. (Ch. 9)

Multithreading — The concurrent execution of multiple threads within a single process, sharing the same memory space. Multithreading enables responsive GUIs and parallel processing but introduces challenges like race conditions and deadlocks. (Ch. 36)

Mutual recursion — A pattern where two or more subprograms call each other. For example, function A calls function B, and function B calls function A. Requires forward declarations in Pascal. (Ch. 22)


N

New — A Pascal built-in procedure that allocates memory on the heap for a pointer type and assigns the address to the pointer variable. The counterpart is Dispose, which frees the memory. (Ch. 14)

nil — A special pointer value indicating that a pointer does not reference any valid memory location. Always initialize pointers to nil and check for nil before dereferencing. Also used as a null object reference. (Ch. 14)

Node — An element in a linked data structure (linked list, tree, or graph). A node typically contains a data field and one or more pointer fields linking it to other nodes. (Ch. 15)


O

Object — An instance of a class, containing its own copy of all the fields defined by the class and its ancestors. Objects are created by calling the class's constructor and freed by calling Free. (Ch. 16)

Object Inspector — A panel in the Lazarus IDE that displays the properties and events of the currently selected component on a form. Properties can be modified at design time through the Object Inspector. (Ch. 27)

Object Pascal — The object-oriented dialect of Pascal supported by Free Pascal and Delphi. Object Pascal extends standard Pascal with classes, inheritance, interfaces, exceptions, generics, and other modern features. (Ch. 16)

Off-by-one error — A common bug where a loop iterates one too many or one too few times, or where an array index is one position too high or too low. One of the most frequent programming errors across all languages. (Ch. 6)

OOP — Object-Oriented Programming. A programming paradigm organized around objects that combine data and behavior. The four pillars of OOP are encapsulation, inheritance, polymorphism, and abstraction. (Ch. 16)

Open array parameter — A parameter declared as array of T (without bounds) that can accept an array of any size. The Low and High functions determine the array's bounds inside the subprogram. (Ch. 9)

Operator overloading — The ability to define custom behavior for standard operators (+, -, *, =, etc.) when applied to user-defined types. In Free Pascal, enabled with the operator keyword. (Ch. 21)

Ordinal type — A type whose values have a defined order and can be enumerated. Pascal's ordinal types include Integer, Char, Boolean, enumerated types, and subrange types. The Ord, Succ, and Pred functions work on all ordinal types. (Ch. 3)

Overflow — A condition where a computation produces a result that exceeds the maximum value a data type can hold. Integer overflow wraps around silently unless range checking ({$R+}) is enabled. (Ch. 3)


P

Packed record — A record declared with the packed keyword, which eliminates alignment padding between fields. Essential for binary file formats where byte-level layout must be exact. (Ch. 34)

Parameter — A value passed to a subprogram. See actual parameter and formal parameter. Pascal supports value parameters, var parameters (pass by reference), const parameters (read-only reference), and out parameters. (Ch. 7)

Pascal — A programming language designed by Niklaus Wirth in 1970, named after the mathematician Blaise Pascal. Originally designed to teach structured programming and good software engineering. Modern Pascal (Free Pascal, Delphi) supports OOP, generics, and system-level programming. (Ch. 1)

Pointer — A variable that stores the memory address of another variable. In Pascal, pointers are declared with the ^ symbol (e.g., PInteger = ^Integer). The ^ is also used to dereference a pointer (access the value it points to). (Ch. 14)

Polymorphism — The OOP principle that allows objects of different classes to respond to the same method call in different ways. Achieved through virtual methods and method overriding. "Poly" means many, "morph" means form. (Ch. 17)

Post-test loop — A loop that checks its termination condition after executing the loop body, guaranteeing at least one execution. Pascal's repeat..until is a post-test loop. (Ch. 6)

Pre-test loop — A loop that checks its condition before executing the loop body, potentially executing zero times. Pascal's while..do is a pre-test loop. (Ch. 6)

Private — A visibility specifier that restricts access to fields, methods, or properties to the class itself (and, in Free Pascal's default mode, to other code in the same unit). The most restrictive visibility. (Ch. 16)

Procedure — A subprogram that performs an action but does not return a value. Declared with the procedure keyword. Contrasted with function. (Ch. 7)

Program — The top-level structure in a Pascal source file. Begins with the program keyword followed by the program name, and contains declarations and a main begin..end. block. (Ch. 3)

Progressive project — A pedagogical approach used in this textbook where a single application (PennyWise) evolves across all 40 chapters, with each chapter adding new features using newly learned concepts. (Ch. 1)

Property — In Object Pascal, a named attribute of a class that provides controlled access to a field through getter and setter methods. Properties look like fields to the caller but execute code on read/write, enabling validation and computed values. (Ch. 16)

Protected — A visibility specifier that allows access from the class itself and from any descendant class, but not from outside code. Used for fields and methods that descendants need to access or override. (Ch. 17)

Public — A visibility specifier that allows unrestricted access from any code. Public members form the class's external interface. (Ch. 16)

Published — A visibility specifier in Object Pascal that is like public but additionally generates RTTI (Runtime Type Information), allowing the Lazarus IDE and streaming system to access the member at design time. Used for component properties and event handlers. (Ch. 27)


Q

Queue — A data structure that follows the FIFO (First In, First Out) principle: elements are added at the rear and removed from the front. Commonly implemented using a linked list with front and rear pointers, or a circular array. (Ch. 15)

Quicksort — A divide-and-conquer sorting algorithm that selects a pivot element and partitions the array into elements less than the pivot and elements greater than the pivot, then recursively sorts each partition. Average time complexity: O(n log n). Worst case: O(n^2), but easily avoided with good pivot selection. (Ch. 23)


R

Race condition — A bug in multithreaded programs where the program's behavior depends on the unpredictable timing of thread execution. Race conditions occur when multiple threads read and write shared data without proper synchronization. (Ch. 36)

Range checking — A compiler feature ({$R+}) that generates runtime checks for array index bounds and subrange type assignments. Detects buffer overflows and invalid values at the cost of slight performance overhead. Highly recommended during development. (Ch. 3)

Read / ReadLn — Built-in procedures for input. Read reads values from the input stream without consuming the end-of-line marker; ReadLn reads values and consumes the remainder of the line. When used with a file variable, they read from that file. (Ch. 4)

Real — A floating-point data type for numbers with fractional parts. Free Pascal's Real is typically 8 bytes (equivalent to Double). Other floating-point types include Single (4 bytes), Double (8 bytes), and Extended (10 bytes on x86). (Ch. 3)

Record — A composite data type that groups related fields of different types under a single name. Declared with the type and record keywords. Records are value types (copied on assignment). See also variant record. (Ch. 11)

Recursion — A technique where a subprogram calls itself to solve a problem by breaking it into smaller instances of the same problem. Every recursive solution requires at least one base case and at least one recursive case that makes progress toward the base case. (Ch. 22)

Reference counting — A memory management technique used by interface variables in Object Pascal. The runtime tracks how many references point to an interfaced object and automatically frees it when the count reaches zero. (Ch. 18)

Reference semantics — The behavior where assignment copies the reference (pointer) rather than the data. In Object Pascal, class variables have reference semantics: a := b makes a and b point to the same object. Contrasted with value semantics. (Ch. 16)

repeat..until — Pascal's post-test loop construct. Executes the body at least once, then checks the condition: the loop continues until the condition becomes True. Note that this is opposite to while, which continues while the condition is True. (Ch. 6)

Reserved word — A word that has a special meaning in the Pascal language and cannot be used as an identifier. Examples: begin, end, if, then, else, while, for, var, const, type, procedure, function, program, uses, class, interface. (Ch. 3)

Reset — A procedure that opens an existing file for reading (for typed and untyped files) or for reading (for text files). The file pointer is positioned at the beginning. Raises an error if the file does not exist. (Ch. 13)

Rewrite — A procedure that creates a new file or overwrites an existing file. The file is opened for writing and any previous content is destroyed. The file pointer is positioned at the beginning. (Ch. 13)

RTTI — Runtime Type Information. Metadata about types generated by the compiler and available at runtime. Used by Lazarus for component streaming, the Object Inspector, and the is/as operators. (Ch. 27)


S

Scope — The region of a program where an identifier (variable, constant, type, or subprogram) is visible and accessible. In Pascal, scope is determined by the nesting of blocks and by unit structure. Inner scopes can shadow identifiers from outer scopes. (Ch. 8)

Self — An implicit parameter available inside every method, referring to the object instance on which the method was called. Analogous to this in C++, Java, and C#. Usually implicit but sometimes needed explicitly to disambiguate. (Ch. 16)

Sentinel value — A special value used to signal the end of input or the termination of a loop. For example, entering 0 or -1 to signal "no more data." The sentinel is not processed as part of the data. (Ch. 6)

Serialization — The process of converting an in-memory data structure into a format that can be stored in a file or transmitted over a network. Deserialization is the reverse. Common serialization formats include JSON, XML, CSV, and binary. (Ch. 34)

Set — A collection of ordinal values from a single base type, supporting mathematical set operations: union (+), intersection (*), difference (-), and membership testing (in). In Free Pascal, sets can contain values with ordinals from 0 to 255. (Ch. 12)

Short-circuit evaluation — See Boolean short-circuit evaluation. (Ch. 5)

ShortString — A Pascal string type with a maximum length of 255 characters, stored as a fixed-size array with the length in byte 0. Allocated on the stack. Used in typed file records where dynamic strings are not permitted. Contrasted with AnsiString. (Ch. 10)

Side effect — Any observable change to program state caused by a subprogram beyond returning a value. Examples: modifying a global variable, writing to a file, printing output. Functions should minimize side effects; procedures typically exist to cause them. (Ch. 7)

Sorting — The process of arranging elements in a specific order (ascending, descending, or by a custom criterion). The textbook covers bubble sort, selection sort, insertion sort, merge sort, and quicksort. (Ch. 23)

Space complexity — The amount of memory an algorithm requires as a function of input size. Measured in Big O notation. For example, merge sort has O(n) space complexity due to its temporary arrays. (Ch. 26)

SQL — Structured Query Language. A standard language for managing and querying relational databases. Used with SQLite in Chapter 31 for database operations (SELECT, INSERT, UPDATE, DELETE). (Ch. 31)

SQLite — A lightweight, file-based relational database engine that requires no separate server process. Ideal for desktop applications. Accessed in Lazarus through the SQLdb components. (Ch. 31)

Stable sort — A sorting algorithm that preserves the relative order of elements with equal keys. Merge sort and insertion sort are stable; quicksort and selection sort are not (by default). (Ch. 23)

Stack (call stack) — See call stack. (Ch. 8)

Stack (data structure) — A data structure that follows the LIFO (Last In, First Out) principle: the most recently added element is the first to be removed. Operations: Push (add to top), Pop (remove from top), Peek (view top without removing). (Ch. 15)

Stack frame — A block of memory on the call stack associated with a single subprogram invocation. Contains the return address, parameters, and local variables. Created when the subprogram is called, destroyed when it returns. (Ch. 8)

Stack overflow — A runtime error that occurs when the call stack exceeds its allocated size, typically due to excessively deep or infinite recursion. (Ch. 22)

Static array — An array whose size is fixed at compile time. Memory is allocated on the stack (for locals) or in the global data segment (for globals). Contrasted with dynamic array. (Ch. 9)

Static typing — A type system where every variable's type is known at compile time and checked by the compiler before the program runs. Pascal is statically typed. Errors caught at compile time cannot occur at runtime. Contrasted with dynamic typing (e.g., Python). (Ch. 1)

String — A sequence of characters. In Free Pascal with {$H+}, String is an alias for AnsiString (dynamic, reference-counted, unlimited length). Standard string operations include Length, Copy, Pos, Insert, Delete, Concat, UpCase, LowerCase, and Trim. (Ch. 10)

Strong typing — A type system that prevents implicit conversions between incompatible types. Pascal is strongly typed: you cannot assign a String to an Integer or pass a Real where an Integer is expected without an explicit conversion. (Ch. 3)

Structured programming — A programming paradigm that uses only sequence, selection (if/case), and iteration (for/while/repeat) as control flow mechanisms, avoiding arbitrary jumps (GOTO). Pascal was designed to enforce structured programming. (Ch. 1)

Subprogram — A general term for a procedure or function. Subprograms allow code reuse, abstraction, and modular organization. (Ch. 7)

Subrange type — A type that restricts an ordinal base type to a contiguous subset of its values. Example: type TGrade = 0..100. Range checking ({$R+}) catches out-of-range assignments at runtime. (Ch. 12)


T

Tail recursion — A special form of recursion where the recursive call is the last operation in the function. Some compilers can optimize tail recursion into iteration, eliminating the risk of stack overflow. Free Pascal performs this optimization in some cases. (Ch. 22)

Thread — An independent path of execution within a process. Multiple threads share the same memory space but execute concurrently. In Free Pascal, threads are created by descending from TThread and overriding the Execute method. (Ch. 36)

Time complexity — The amount of time an algorithm takes as a function of input size. Measured in Big O notation. Common time complexities (from fastest to slowest): O(1), O(log n), O(n), O(n log n), O(n^2), O(2^n), O(n!). (Ch. 26)

TObject — The ultimate ancestor class in Object Pascal. Every class implicitly descends from TObject, which provides fundamental methods including Create, Destroy, Free, ClassName, and ClassType. (Ch. 16)

Tree — A hierarchical data structure consisting of nodes connected by edges, where each node has at most one parent and zero or more children. The topmost node is the root. Nodes with no children are leaves. See also binary tree. (Ch. 24)

Tree traversal — The process of visiting every node in a tree exactly once. Common traversals: inorder (left, root, right), preorder (root, left, right), postorder (left, right, root), and level-order (breadth-first). (Ch. 24)

try..except — Pascal's exception-handling construct. Code in the try block is monitored for exceptions. If an exception occurs, execution jumps to the except block, where on clauses handle specific exception types. (Ch. 19)

try..finally — A construct that guarantees the finally block executes regardless of whether an exception occurs in the try block. Used for resource cleanup: closing files, freeing objects, releasing locks. (Ch. 19)

TStringList — A versatile class from the Classes unit that manages a list of strings with associated objects. Supports sorting, duplicate detection, name-value pairs, and file I/O. One of the most frequently used utility classes in Object Pascal. (Ch. 10)

Turbo Pascal — A Pascal compiler and IDE created by Anders Hejlsberg for Borland, first released in 1983. Turbo Pascal was revolutionary for its fast compilation speed and integrated environment. It evolved into Delphi. (Ch. 1)

Type — A classification that determines a variable's possible values, memory size, and allowed operations. Pascal's type system is the foundation of its safety: the compiler enforces type rules and catches mismatches before the program runs. (Ch. 3)

Typed file — A file whose elements are all the same type, declared as file of T. Typed files support random access via Seek and FilePos. The element type must have a fixed size (no dynamic strings or class references). (Ch. 13)


U

Unicode — A character encoding standard that assigns a unique code point to every character in every writing system. In Free Pascal, UnicodeString and UTF8String support Unicode text. Lazarus uses UTF-8 encoding internally. (Ch. 10)

Unit — Pascal's module system. A unit is a separate source file that provides an interface (public declarations) and an implementation (private code). Units enable separate compilation, information hiding, and code reuse. Other programs and units access a unit's public members through the uses clause. (Ch. 33)

uses clause — A statement that imports declarations from one or more units into the current compilation unit or program. Can appear in both the interface section and the implementation section of a unit. (Ch. 33)


V

Value parameter — The default parameter passing mode in Pascal. The formal parameter receives a copy of the actual parameter's value. Modifications to the formal parameter do not affect the actual parameter. (Ch. 7)

Value semantics — The behavior where assignment copies the data itself, not a reference. Records and simple types in Pascal have value semantics: a := b creates an independent copy. Contrasted with reference semantics. (Ch. 11)

var parameter — A parameter passed by reference. The formal parameter becomes an alias for the actual parameter's memory location. Changes to the formal parameter directly change the actual parameter. Required when a subprogram needs to modify the caller's variable. (Ch. 7)

Variable — A named storage location in memory whose value can change during program execution. In Pascal, every variable must be declared with a type before use. (Ch. 3)

Variant record — A record type where some fields overlap in memory, with a discriminant (tag field) indicating which variant is currently active. Variant records are Pascal's mechanism for representing values that can be one of several different shapes. Largely superseded by inheritance in Object Pascal. (Ch. 11)

Virtual method — A method declared with the virtual keyword that supports dynamic dispatch. When a virtual method is called on a variable typed as an ancestor class, the version of the method belonging to the actual runtime class of the object is executed. See also polymorphism. (Ch. 17)

Virtual method dispatch — The mechanism by which the runtime determines which implementation of a virtual method to call, based on the actual class of the object rather than the declared type of the variable. Implemented through the Virtual Method Table (VMT). (Ch. 17)

VMT — Virtual Method Table. A data structure maintained by the runtime for each class, containing pointers to the class's virtual methods. When a virtual method is called, the runtime looks up the correct method implementation in the VMT. (Ch. 17)


W

while..do — Pascal's pre-test loop construct. Evaluates the condition before each iteration. If the condition is False initially, the loop body never executes. Continues while the condition remains True. (Ch. 6)

Widgetset — The platform-specific layer in the LCL that translates abstract component operations into native operating system widgets. Examples: win32 (Windows), cocoa (macOS), gtk2 and qt5 (Linux). This architecture allows Lazarus applications to have native look and feel on each platform. (Ch. 27)

Wirth, Niklaus — Swiss computer scientist (1934-2024) who designed Pascal, Modula-2, and Oberon. Author of the seminal Algorithms + Data Structures = Programs (1976). Won the Turing Award in 1984. Pascal is named after mathematician Blaise Pascal at Wirth's choice. (Ch. 1)

with statement — A Pascal statement that temporarily opens a record's or object's scope, allowing its fields and methods to be referenced without the qualifying name. Should be used sparingly because it can create scope ambiguity. (Ch. 11)

Write / WriteLn — Built-in procedures for output. Write outputs values without a newline; WriteLn outputs values followed by a newline. Both support format specifiers for field width and decimal places. When used with a file variable, they write to that file. (Ch. 4)


X

XML — eXtensible Markup Language. A text-based format for structured data using nested elements with opening and closing tags. More verbose than JSON but supports schemas, namespaces, and attributes. In Free Pascal, the DOM and XMLRead/XMLWrite units handle XML processing. (Ch. 34)


Y

No glossary entries for Y.


Z

No glossary entries for Z.