Achieving Zero-Cost Abstractions in Rust with Iterators and Generics
Learn how Rust's iterator chains and generic functions compile to assembly equivalent to hand-written loops, giving high-level code zero runtime overhead.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
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.
Objective-C nullability annotations and lightweight generics are compile-time only, but they reshape how your headers import into Swift — turning String! into String? and [Any] into [String]. Here is how to adopt them incrementally in a legacy codebase.
Stop relying on risky typecasts. Learn how to implement type-safe collections in Delphi using System.Generics.Collections to eliminate runtime errors and improve performance.