KOL and MCK

A reference on Object Pascal, the Delphi line and the libraries built on it.

Versions

Generics Arrived in 2009 and the Language Was Not the Same

The type-parameterised containers that reached Delphi 2009 were long overdue — and their syntax made that visible.

KOL and MCKVersions

Young man types code on a vintage CRT monitor in a computer lab

Generics arrived in 2009 carrying implementation constraints the syntax does not show.

A New Kind of Polymorphism

Delphi 2009 arrived carrying two changes significant enough to rewrite existing codebases: the shift from AnsiString to UnicodeString as the default string type, and the introduction of generics. The Unicode migration was the louder disruption at the time, but generics altered what the language could express at a structural level.

The syntax Borland's successors at CodeGear chose used angle brackets — TList<T>, TDictionary<TKey,TValue> — matching the convention already established by C# and Java rather than reaching back to any Pascal tradition. The choice was deliberate and pragmatic: developers already reading generic C# code would find the notation legible without a learning curve. The standard library gained a family of generic containers in the Generics.Collections unit, including lists, dictionaries, queues and stacks, each operating on a caller-supplied type without sacrificing type safety.

Delphi 1 retail box, CD and printed manual set arranged on a desk, 1995 Borland packaging and logo legible, warm tungsten light

A parts store rather than a code library, but the same premise — take a standard piece off the shelf instead of making one.

Photo: Charlie Merrow / Pexels

Delphi form designer mid-drag on a CRT monitor, component palette open at right, adult developer's hand on the mouse at the edge of the frame, screen the brightest light source in the room

The CRT is the era's one constant: everything in this section happened on a screen this shape.

Photo: cottonbro studio / Pexels

The implementation came with documented constraints. Constraints on type parameters — limiting a parameter to class types, to types implementing a particular interface, or to types with a default constructor — were supported, but the constraint vocabulary was narrower than what C# 2.0 had offered since 2005. Generic methods on non-generic classes, a pattern routine in Java and C#, arrived later and with rough edges in early releases. The single-pass compiler architecture, a structural inheritance from Niklaus Wirth's original Pascal at ETH Zürich, complicated certain instantiation strategies and contributed to incremental compiler speed concerns that users documented in the years following the release.

The practical gain was immediate regardless. The TList<T> replacement for the untyped TList eliminated entire categories of typecast error. Generic containers also fitted comfortably alongside Delphi's existing component model, since the new typed lists could sit inside ordinary VCL classes and replace the untyped lists in them. What arrived in 2009 was incomplete relative to contemporaneous languages ↗, but it was real, typed and — unlike the CLX experiment — it stayed.

More in Versions

All of Versions