HoldFastPlayground

Handler, async and surface design comparisons

These comparisons identify technical approaches relevant to the handler and async design and the HoldFast surface grammar. Each claim concerns its cited proposal, implementation or paper.

Effect-handler disposal routes

OCaml's discontinue resumes at the effect site by raising an exception. An abandoned continuation can retain its captured resources. OCaml effect handlers

Dynamic Wind pairs a suspend clause that releases resources on capture with a resume clause that reacquires them. Its resource-safety argument concerns a paper machine instrumented to close resources. That strategy requires resources that can be released and reacquired, which excludes a loan still held by a device or in-flight DMA. HoldFast's handler design requires explicit disposal on every relevant exit. Dynamic Wind for Effect Handlers

Handler scoping and continuation copying

Nearest-handler lookup can route an operation to an unrelated dynamically enclosing handler. Effekt and Lexa select handlers through lexically scoped capabilities. Continuation cloning also needs to rebind references into the copied frames. Virtualizing Continuations uses virtual handler addresses. HoldFast's candidate design uses delimiter-relative frame references. Virtualizing Continuations · HoldFast handler representation

Yang and Wu study laws for higher-order scoped operations. Whiting and Germane's HMCFA provides a control-flow analysis to compare when specializing handlers. Judgmental monadic laws · HMCFA

Automatic resource analysis for handlers

RaML+ annotates operations with potential, uses explicit forwarding and analyzes linearly typed continuations. HoldFast can treat an inferred bound for its one-shot fragment as a candidate for kernel checking. Multi-shot bounds require separate composition laws. Handling Exceptions and Effects with Automatic Resource Analysis

Async and await design space

Gray, Krishnamurthi and Crichton compare async systems by eagerness, suspension, extent, reference strength, destruction, propagation and cancellation behavior. They test a Redex model against language runtimes with generated programs. HoldFast's structured async design uses these dimensions to state its own lifecycle and resource rules. A Design Space Exploration of Async/Await

Structured-concurrency runtimes

System Relevant behavior in the cited design
Java Closing a structured scope waits for subtasks. A subtask that fails to respond to interruption can delay closing indefinitely. JEP 533
Python TaskGroup cancels siblings on failure, waits for them and aggregates non-cancellation exceptions, with special handling for KeyboardInterrupt and SystemExit. asyncio.TaskGroup
Swift A cancellation shield delays observation of cancellation within a lexical block. An awaited defer runs before leaving its scope. Cancellation shields · Awaited defer
Kotlin Prompt cancellation can supersede a ready result. A resource in that result needs an explicit cancellation handler. Prompt cancellation
C++ Execution distinguishes stopped, value and error completions. An unjoined used simple_counting_scope terminates on destruction. Scope specification · Spawn proposal
Rust The async roadmap describes immovable types and guaranteed destructors as prerequisites for scoped spawn and async drop. Move-trait project goal

HoldFast's cancellation contract requires accounting for ready results and bounded cancellation. The frame rules assign static storage and track each child's exit resources.

C# unions and Swift spans

C#'s proposed type union union Pet(Cat, Dog, Bird) wraps existing case types and boxes value-type cases. HoldFast uses nominal tagged unions with explicit cases and exhaustive matching. C# union proposal

Swift's Span is a copyable shared view and MutableSpan is a noncopyable exclusive view. The source lifetime bounds both views. Swift MutableSpan

Hylo uses projection subscripts with let, inout, set, and sink to support in-place mutation. OxCaml infers mode information such as locality, uniqueness, and contention. Its mode-crossing rules include deeply immutable types. Hylo mutable value semantics · OxCaml modal axes · Mode Crossing

HoldFast exposes in, ref, out, and move at call sites. Its design combines place-named lifetimes and two-phase receiver loans with functional and resource proofs. Values that cross ownership modes require checked laws. Loan modes · Mode-crossing qualification