Episode 216 minutes
Native CLI Apps: Structs, Typed JSON & Map<K, V>
Build production CLI tools using value-semantic structs, typed to_json / from_json<T> serialization, and Map<K, V> dictionaries.
Lesson Video Coming Soon
This episode's HD lesson video will appear directly in this player once published. Meanwhile, run and modify the live HADID v0.13 code lab right below!
Learning Objectives
- Define value-semantic data models with struct
- Serialize and validate JSON cleanly with to_json and from_json<T>
- Safely read dictionary values with Map<K, V> and ?? defaults
Architecture Summary
HADID struct types have strict value semantics. to_json(val) serializes structs, lists, and maps to RFC 8259 JSON, while from_json<T>(raw) returns Result<T, string> so malformed payloads never crash your app.
Live HADID v0.13 Code Lab
LIVE COMPILER
Episode 2 · Interactive Lab
main.had· Run with Ctrl / ⌘ + Enter
Run with Ctrl / ⌘ + Enter
Executes on the real HADID v0.13.0 Linux compiler inside a network-isolated container (async/await, closures, Generic fn<T> + where, Query<T>, loop-fused lambdas, html_render, crypto, SQLite :memory:, and full EN/TR syntax). Use the local `hadid` CLI for disk SQLite, live WebSocket/HTTP servers, and native AOT binaries.
Sign in with Digital HAT ID to earn Code Lab (+25 XP), Quiz (+50 XP), badges, and certificates.Sign In