Compiler Pipeline Gets Its Papers in Order
Talk tightens typed HIR and MIR-owned ownership facts, while basic OS IO and everyday tools get a tidy lift.
Today's Talk release is a careful shop-floor issue: the compiler now carries more facts in the structures that actually use them, the IO path reaches the process environment, and the formatter keeps a closer eye on intent.
Talk's IO path now reaches current-directory, environment-variable, argument, and exit operations. The new operations are wired through lowering, the reference evaluator, and VM scheduling, with OS.tlk added to the core source list.
That means this release broadens the existing IO road rather than opening a side alley: cwd, getenv, argv, and exit travel alongside files, sockets, and sleep.
Lowering now reads drop elaboration and move facts from the MIR statement it is walking. The new ownership test for a moved string s expects both a Dead drop and a move to be projected onto statement.ownership.
The practical gain is locality: code generation consults the exact MIR body in hand, reducing stale side-table lookups.
Typed trees, local ownership facts, and a few more doors to the operating system.- The day's release, in one line
func f(x: Int) -> Int { // The binding gives HIR a simple // expression identity to // preserve. let y = x // Returning y checks that later // expression IDs still point back // to source. y } // The call site is another // expression that must survive // lowering one to one. f(x: 2)
Ownership checking still runs for the compiler, but drop-plan obligations and move-fact output are now produced only when editor features request them. The new test checks that compiler mode leaves those outputs empty, while editor mode fills them for inlay hints.
It is a small economy with a clear owner: diagnostics keep working, and the more expensive explanatory facts are saved for the tools that display them.
The for-loop transform now desugars into an explicit loop over .next(). It builds a unique __for_iter_<id> local, matches Optional.some and Optional.none, and appends a synthesized unit expression for the outer block result.
The surface form stays friendly, while the lowered shape becomes more predictable for the compiler.
talk format now recognizes if let shapes and preserves them instead of flattening away the intent. Tests cover optional matching with and without else.
Handler bodies also get cleaner multiline match formatting, including the @handle 'os case that matches cwd and args requests.