e7c2fd02df
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
16 lines
536 B
EmacsLisp
16 lines
536 B
EmacsLisp
// time-literals.el — postfix-literal duration recognition.
|
|
// `30.seconds` lowers to a DurationLit AST node carrying the count and the
|
|
// unit; codegen emits a literal int64 nanosecond constant. duration_to_seconds
|
|
// reverses the lowering and yields the original count.
|
|
|
|
// `test` is reserved by El's lexer as a property-test keyword, so the
|
|
// example body lives in `run_test()`.
|
|
fn run_test() -> Int {
|
|
let d: Duration = 30.seconds
|
|
return duration_to_seconds(d)
|
|
}
|
|
|
|
fn main() -> Void {
|
|
println(int_to_str(run_test()))
|
|
}
|