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.

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

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
