#enum Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Kotlin Enums with Properties and Methods
Kotlin enums can carry constructor properties and define methods — including abstract methods overridden per constant. Way more expressive than Java enums.
Rust Serde — Field Rename, Skip, and Tagging
Per-field attributes let you map between Rust's snake_case and the JSON's camelCase, skip optional fields, and tag enum variants the way external APIs expect.
TypeScript const Assertions for Literal Types
`as const` freezes a value as deeply readonly and infers the narrowest possible literal types. Replaces enums for most use cases — better tree-shaking, no runtime cost.
Go iota — Auto-Incrementing Constants (Enums)
Go has no `enum` keyword but `iota` inside a const block gives you the same effect. Each line is the previous expression with iota auto-incremented.
Java Singleton via enum
`enum` with a single value is the simplest correct singleton implementation: lazy, thread-safe, serialization-safe, reflection-safe. Joshua Bloch's recommendation in Effective Java.