`by lazy { ... }` runs the block on first access, caches the result. Default mode is thread-safe (synchronized). Perfect for expensive initialization where you might never need the value.
`coroutineScope { }` waits for ALL its children before returning. If any child throws, the others are cancelled. The cornerstone of structured concurrency — no leaked coroutines.
`async` returns a `Deferred<T>` — like a Future. Use it when you need a RESULT back, in parallel. Call `.await()` to get the value (suspends until ready).
`suspend fun` can be paused and resumed without blocking a thread. Call only from another `suspend` function or a coroutine builder (`launch`, `runBlocking`, `async`).
For shared counters and flags, `AtomicU64` / `AtomicBool` etc. are much faster than `Mutex`. Operations like `fetch_add` are single CPU instructions on most architectures.
Compare two strings in constant time to avoid timing-attack leaks when checking secrets like API keys, session tokens, or HMAC signatures. Always use hash_equals — never ===.
`chunked(n)` splits a list into NON-overlapping pieces of size n. `windowed(n)` slides a fixed-size window across — overlapping. Useful for moving averages, n-grams, batch APIs.
The standard library ships a production-quality HTTP server. `http.HandleFunc` registers a function; `http.ListenAndServe` blocks forever serving requests.
A reusable trait that turns any class into a lazily-instantiated singleton with a single ::instance() accessor. Throws on clone/wakeup to prevent accidental duplication.
A column whose value is derived from other columns and maintained automatically. PostgreSQL has STORED (persisted) and MySQL adds VIRTUAL (computed on read). Saves you from triggers for derived data.
A pipeline is a chain of stages connected by channels — each stage runs in its own goroutine. Classic Go pattern for streaming transformations with backpressure built in.
SQL date_trunc — Bucket Times into Hours/Days/Weeks
`date_trunc('day', ts)` rounds a timestamp down to the start of the day. Use for time-series GROUP BYs — daily/weekly/hourly buckets without messy arithmetic.
Java 9+ static factory methods return immutable collections with no nulls allowed. Concise, fast, and safer to share across threads or APIs than mutable equivalents.
Like array_unique, but the uniqueness test is a callback that returns the key to dedupe by. Useful for "unique by ID" or "unique by lowercased email" across arrays of objects/rows.