Delphi Generics: When Type Safety Meets Binary Size
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.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
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.
Learn how Rust's iterator chains and generic functions compile to assembly equivalent to hand-written loops, giving high-level code zero runtime overhead.
Explore how Crystal’s global type inference works with generics to give Ruby‑like syntax and static type safety, complete with a compile‑time example and practical checks.
Go infers generic type arguments by unifying call-site argument types with type parameters — conservatively. Here's how it works, where it gives up, and how to design APIs that infer cleanly.
Zig's comptime turns generics, lookup tables, and compile-time validation into ordinary Zig code. A worked fixed-capacity stack example, plus the real trade-offs: compile times, error messages, and version churn.
Go 1.18 generics let you write a single concurrent cache that the compiler instantiates per key-value type pair, catching mismatches at build time. This post shows a working implementation, a two-cache example, and the trade-offs around binary size.
Zig's comptime replaces macros and templates with ordinary code evaluated by the compiler. Here's how it powers zero-cost generics, with a ring buffer example and the trade-offs.
Zig's comptime replaces macros, templates, and code generators with one mechanism: ordinary Zig functions executed at compile time. A look at generics, a worked JSON serializer, and the real costs.