This post analyzes the Kit Lang Advanced Syntax Design proposal against Kit's existing language features, with links to official documentation and source evidence.
r/kit_lang recently saw its first user post 🎉! This led to a community proposal for advanced Kit syntax that surfaced on GitHub, covering decimal literals, error propagation, computation expressions, units of measure, and more. The proposal identifies real problems—float precision, monadic nesting, unit safety, and crypto primitives—but most of what it asks for is already built into Kit today. This post maps every requested feature against what Kit actually provides today.
What Kit Already Has
The following table lists each proposal request alongside its current status in Kit, with direct links to grammar definitions and source code.
| Proposal Request | Kit Status | Evidence |
|---|---|---|
| Decimal literals | Exists — 100.00M / 100.00m |
GRAMMER.md#L604, src/il/il.zig#L64 |
| BigInt literals | Exists — 999999999999999999I / 100i |
GRAMMER.md#L612, src/il/il.zig#L65 |
BigDecimal module |
Exists — 30 builtins in interpreter | interpreter.zig#L2960-2994 |
Error propagation (?!) |
Exists — postfix unwrap-or-return | GRAMMER.md#L667, GRAMMER.md#L1098-1100 |
Null coalesce (??) |
Exists — value ?? default |
GRAMMER.md#L655 |
guard macro |
Exists — pattern bind or early return | GRAMMER.md#L179 |
as / is macros |
Exists — extract/test patterns | GRAMMER.md#L175-177 |
| Pipe operators | Exists — |> (thread-first), |>> (thread-last) |
GRAMMER.md#L651-669 |
extern-c FFI |
Exists — bind C functions directly | GRAMMER.md#L220-228 |
extern-zig FFI |
Exists — bind Zig functions directly | GRAMMER.md#L223-228 |
| Traits / type classes | Exists — trait / extend syntax |
GRAMMER.md#L237-255 |
| Refinement types | Exists — {n: Int | n > 0} |
GRAMMER.md#L493-516 |
| Match macros | Exists — is, as, guard |
GRAMMER.md#L170-188 |
kit-crypto module |
Exists — kit-crypto package | SHA-256/512, HMAC, secure compare. ffi-zig package with no external deps — uses Zig std.crypto only |
Official Documentation References
Most of these features are documented in the official Kit guide and standard library. The following links point to the current docs release.
| Feature | Official URL |
|---|---|
Error handling (?!, ??, guard, Result, Option) |
kit-lang.org/docs/2026.4.20/guide/error-handling.html |
Pattern matching (is, as, guard, active patterns) |
kit-lang.org/docs/2026.4.20/guide/pattern-matching.html |
| Active patterns (blog post) | kit-lang.org/blog/2026-03-07-active-patterns.html |
| Type system (traits, refinement types) | kit-lang.org/docs/2026.4.20/guide/types.html |
| Functions (lambdas, closures, pipes) | kit-lang.org/docs/2026.4.20/guide/functions.html |
| Grammar specification | kit-lang.org/docs/2026.4.20/guide/grammar.html |
| BigDecimal stdlib | kit-lang.org/docs/2026.4.20/stdlib/bigdecimal.html |
What the Proposal Requests That Is Not in Kit
A small number of requested features are not present in Kit today. The table below lists them, along with why they are not needed or how they can be built as libraries.
| Proposal Request | Status | Notes |
|---|---|---|
with blocks (computation expressions) |
Not present | Redundant with ?!, guard, as, |> |
d suffix for decimal |
Not present | M suffix already serves this role |
{-# default-decimal #-} pragma |
Not present | Would contradict explicit-by-default philosophy |
Fixed(n) compile-time fixed-point |
Not present | Can be built as a library with traits + phantom types |
Units of measure (unit USD, Decimal<USD>) |
Not present | Can be built as a library with phantom types + refinement types |
Comparison: "Pyramid of Doom" Example
Both the proposal's "before" snippets and the counter-examples below have been verified against
kit format and kit check (with stubs for unbound names).
Proposal's "before" (nested Result.and-then)
module Example
main = fn =>
place-limit-order "AAPL" 100.0M 10
place-limit-order = fn(symbol, price, qty) =>
fetch-price(symbol)
|> Result.and-then fn(tick) =>
get-account()
|> Result.and-then fn(account) =>
# ...
Ok no-op
Kit's existing ?! solution
module Example
main = fn =>
place-limit-order "AAPL" 100.0M 10
place-limit-order = fn(symbol, price, qty) =>
tick = fetch-price(symbol) ?!
account = get-account() ?!
guard true = account.buying-power >= price * qty else Err InsufficientFunds
submit-order({symbol: symbol, price: price, qty: qty})
Kit's existing guard solution
module Example
main = fn =>
println (process (Some 42))
process = fn(opt) =>
guard Some value = opt else Err "was None"
guard true = value > 0 else Err "not positive"
Ok (value * 2)
F# CE Feature → Kit Equivalent
The proposal borrows heavily from F# computation expressions. Kit achieves the same ergonomics with a smaller surface area.
| F# | Kit |
|---|---|
let! (async bind) |
?! (unwrap or return early) |
return |
last expression in function |
return! |
?! or direct value |
if ... then return |
guard |
async { } / option { } |
?! + guard + pipes — no block syntax needed |
Codegen and Runtime Evidence
Kit's implementation is not just syntax-deep. Decimal and BigInt have first-class representations in the intermediate language, backends, and serialization layers.
- Decimal values are stored as strings in IL for precision: src/il/il.zig#L64
- Zig backend emits decimal as
KitValue { .decimal = "..." }: codegen.zig#L14775 - BigInt uses
std.math.big.int.Managed: interpreter.zig#L8646 - Both
.decimaland.biginthave archive/cache serialization: cache.zig#L1150-1151, archive.zig#L422-423
Follow-up
The proposal is a great example of the ideas coming out of the community. One of the strongest use cases pushing Kit forward is automated trading, and the proposal reflects that real-world need.
Several requested features—Fixed(n) and units of measure, for example—fit well as third-party or
first-party packages rather than core language additions. kit-crypto
already fills one of those gaps as a first-party package, providing SHA-256/512, HMAC, and secure comparison
via Zig's std.crypto. A dedicated kit-cryptocurrencies package could layer on top of
it for wallet primitives, exchange APIs, and order types, keeping the core crypto package lean. We're also
actively developing kit-finance to address the trading use case directly.