Modern Programming Terms Explained
for Old‑School PureBasic Developers

FFI — Foreign Function Interface

Modern definition:
Calling functions written in another language or compiled separately.

PureBasic translation:
Using OpenLibrary(), GetFunction(), and CallFunction() to call DLL functions.

OpenLibrary(0, "user32.dll") MessageBox = GetFunction(0, "MessageBoxW") CallFunctionFast(MessageBox, 0, @"Hello", @"Title", 0) CloseLibrary(0)

Trampoline

Modern definition:
A small function that forwards a call to another function, often adjusting parameters.

PureBasic translation:
A Procedure that prepares arguments, logs, validates, or transforms them, then calls another Procedure.

Procedure RealFunction(a, b) ProcedureReturn a + b EndProcedure Procedure Trampoline(a, b) Debug "Calling RealFunction..." ProcedureReturn RealFunction(a, b) EndProcedure

Thunk

Modern definition:
A tiny wrapper that delays or redirects a function call.

PureBasic translation:
A Procedure that exists only to call another Procedure.

Procedure Delayed() Debug "Doing something later..." RealAction() EndProcedure

Closure

Modern definition:
A function that carries its own data/environment with it.

PureBasic translation:
A Procedure plus a structure of variables you pass along with it.

Structure CallbackData Value.i EndStructure Procedure Callback(*Data.CallbackData) Debug "Value = " + *Data\Value EndProcedure

Continuation

Modern definition:
A representation of “what happens next.”

PureBasic translation:
Saving state so a Procedure can resume later (state machines, timers, event loops).

Select State Case 0 Debug "Start" State = 1 Case 1 Debug "Continue" State = 2 Case 2 Debug "Finish" EndSelect

Coroutine

Modern definition:
A function that pauses and resumes while keeping its state.

PureBasic translation:
A Procedure that yields control and picks up where it left off (manual state machine).

Procedure Coroutine() Static Step Select Step Case 0: Debug "Step 0": Step = 1 Case 1: Debug "Step 1": Step = 2 Case 2: Debug "Step 2": Step = 0 EndSelect EndProcedure

RAII — Resource Acquisition Is Initialization

Modern definition:
Resources are tied to object lifetime; cleanup happens automatically.

PureBasic translation:
Open something → use it → ensure it closes.

If OpenFile(0, "test.txt") WriteString(0, "Hello") CloseFile(0) EndIf

Dependency Injection

Modern definition:
Providing dependencies from the outside instead of creating them internally.

PureBasic translation:
Passing handles, objects, or settings into Procedures instead of using globals.

Procedure Draw(CanvasID) If StartDrawing(CanvasOutput(CanvasID)) Circle(50, 50, 20) StopDrawing() EndIf EndProcedure

Reflection

Modern definition:
Inspecting or modifying program structure at runtime.

PureBasic translation:
Anything that inspects types, fields, or functions dynamically.

ParseJSON(0, "{" + #DQUOTE$ + "name" + #DQUOTE$ + ":" + #DQUOTE$ + "PB" + #DQUOTE$ + "}") Debug GetJSONString(GetJSONMember(JSONValue(0), "name"))

ABI — Application Binary Interface

Modern definition:
Rules for how functions are called at the machine level.

PureBasic translation:
Matching DLL parameter types and calling conventions.

; Passing correct types to a DLL function = respecting the ABI CallFunctionFast(MyDLLFunc, 123, @"Text", 0)

Marshalling

Modern definition:
Converting data between formats or languages.

PureBasic translation:
Packing arguments so a DLL understands them (UTF‑8, pointers, integers).

*utf = UTF8("Hello") CallFunctionFast(MyFunc, *utf) FreeMemory(*utf)

Monads

Modern definition:
A pattern for chaining operations with context (errors, state, async).

PureBasic translation:
Chaining functions where each step depends on the previous one.

If LoadImage(0, "pic.png") If StartDrawing(ImageOutput(0)) Circle(50, 50, 20) StopDrawing() EndIf EndIf

Memoization

Modern definition:
Caching function results to avoid recalculating.

PureBasic translation:
Storing results in a map or array.

Global NewMap Cache.i() Procedure Fib(n) If FindMapElement(Cache(), Str(n)) ProcedureReturn Cache() EndIf If n < 2 Cache(Str(n)) = n Else Cache(Str(n)) = Fib(n-1) + Fib(n-2) EndIf ProcedureReturn Cache(Str(n)) EndProcedure

Immutability

Modern definition:
Data that cannot be changed once created.

PureBasic translation:
Using constants or treating structures as read‑only.

; #MaxValue cannot be changed #MaxValue = 100

Event Sourcing

Modern definition:
State is derived from a log of events.

PureBasic translation:
Replaying a list of actions to rebuild state.

Global Events.s() AddElement(Events()) : Events() = "Add 5" AddElement(Events()) : Events() = "Add 3" ForEach Events() If Events() = "Add 5" : Total + 5 : EndIf If Events() = "Add 3" : Total + 3 : EndIf Next

Actor Model

Modern definition:
Independent units that communicate via messages.

PureBasic translation:
Message loops, threads posting events, window callbacks.

PostEvent(#PB_Event_User, 0, 0, 0, 123)

Zero‑Copy Buffers

Modern definition:
Passing data without copying it.

PureBasic translation:
Passing pointers instead of duplicating memory.

*Buffer = AllocateMemory(1024) ProcessData(*Buffer) FreeMemory(*Buffer)

Type Erasure

Modern definition:
Removing type information so code can treat values generically.

PureBasic translation:
Using pointers or variants to store “anything.”

Global *Any *Any = AllocateMemory(4) PokeI(*Any, 123) Debug PeekI(*Any) FreeMemory(*Any)

VTable Dispatch

Modern definition:
Calling methods through a table of function pointers.

PureBasic translation:
A structure containing function pointers.

Structure VTable DoThing.i EndStructure Procedure Action() Debug "Doing thing!" EndProcedure Global vt.VTable vt\DoThing = @Action() CallFunctionFast(vt\DoThing)

JIT Compilation

Modern definition:
Generating machine code at runtime.

PureBasic translation:
Not built‑in, but similar to loading DLLs created at runtime.

; Conceptual only — PureBasic doesn't JIT OpenLibrary(0, "Generated.dll") CallFunctionFast(GetFunction(0, "Run")) CloseLibrary(0)