Stop Casting Everything: Using Delphi Generics to Eliminate Type-Safety Risks
Stop relying on risky TObject casts. Learn how to use Delphi Generics to move type-checking from runtime to compile-time, reducing crashes and boilerplate code.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Stop relying on risky TObject casts. Learn how to use Delphi Generics to move type-checking from runtime to compile-time, reducing crashes and boilerplate code.
Learn how Kotlin's inline functions and reified type parameters overcome JVM type erasure to create cleaner, type-safe APIs without the boilerplate of passing Class objects.
Learn how Go generics cut boilerplate while keeping type safety and performance. A step‑by‑step guide with a concrete Max example, benchmarks, and practical trade‑off considerations.
Learn how Crystal’s gradual typing lets you write flexible containers that stay type‑safe by applying generic constraints and the `type` keyword.
Discover how Go’s generics let you replace boilerplate with a single, fast, type‑safe function. Follow a concrete Max example, see the performance impact, and learn when to keep generics in check.
Before Delphi 2009, the built‑in TList stored TObject references and forced developers to cast every addition and retrieval, opening the door to runtime type errors. Delphi’s generics, especially TList<T>, let you declare the element type once and get compile‑time safety without extra casting.
Ceylon removes Java's wildcard boilerplate with declaration-site variance and type inference, but JVM erasure means bridge methods and hidden casts remain. Here is how to verify the tradeoff before adopting it.
Delphi’s generic types give compile‑time safety and clean code, but they can inflate your binary. Learn how to use generics, constrain types, and measure the impact in a real example.
Zig's comptime turns types into ordinary compile-time arguments, giving you monomorphized generic containers with no void* and no runtime cost. A worked List(T) example, plus the trade-offs.