add Instant + Duration as first-class types in El

Postfix literal syntax (30.seconds, 1.hour). Type-checked arithmetic
(Instant + Duration -> Instant; Instant + Instant fails). TTL helpers
backed by typed Duration. sleep(Duration) replaces ambiguous sleep(Int).

Self-host fixed point holds at 5797 lines.
Snapshot tagged at dist/platform/elc.20260502-1256-self-host.

Phase 2 (every/after/at scheduling primitives) lands separately.
Backlog: bl-937e9c30
This commit is contained in:
Will Anderson
2026-05-02 12:57:13 -05:00
parent af480f6266
commit e7c2fd02df
10 changed files with 280 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
// ttl-cache.el TTL helpers backed by typed Duration. Storing under a key
// stamps the set time as an Instant; ttl_cache_get computes the age and
// returns the value only if the age is within the supplied Duration.
// `test` is reserved; using `run_test` instead.
fn run_test() -> String {
ttl_cache_set("key1", "hello")
let v: String = ttl_cache_get("key1", 1.hour)
return v
}
fn main() -> Void {
println(run_test())
}