Core Concepts
This page defines the minimum vocabulary you need to read and write Konditional features.
Terms
- Namespace: A registry that owns a set of features.
- Feature: A typed configuration value with rules and a default.
- Context: Runtime inputs used for evaluation (
locale,platform,appVersion,stableId). - Rule: Criteria -> value mapping. All criteria must match for the rule to apply.
- Specificity: A numeric measure of how constrained a rule is. Higher specificity wins.
- Bucketing: Deterministic assignment of a
stableIdto a ramp-up bucket.
Compile-time vs runtime
| Aspect | Guarantee Level | Mechanism |
|---|---|---|
| Property access | Compile-time | Property delegation on Namespace |
| Return types | Compile-time | Generic type propagation (Feature<T, C, M>) |
| Rule values | Compile-time | Typed DSL builders (boolean, string, enum, custom) |
| Non-null returns | Compile-time | Required defaults |
| Rule matching | Runtime | Deterministic evaluation over Context |
| Business logic correctness | Not guaranteed | Human responsibility |
Typed values in practice
enum class Theme { LIGHT, DARK }
object AppFeatures : Namespace("app") {
val darkMode by boolean<Context>(default = false)
val theme by enum<Theme, Context>(default = Theme.LIGHT)
val retries by integer<Context>(default = 3)
}
val theme: Theme = AppFeatures.theme.evaluate(ctx)
Type-safety guarantee
-
Guarantee: Feature access and return types are compile-time safe for statically-defined features.
-
Mechanism: Feature properties are declared with explicit type parameters and enforced by the Kotlin type system.
-
Boundary: Dynamically-generated features are outside this guarantee.