_with_host

func _with_host(consume body: Task) -> ()

The executable's host fallbacks (ADR 0039): ordinary handlers below every user handler, installed around the whole program by the entry wrapper. Which effects are ambient at the top level is exactly the row this callback declares — the compiler reads it from this signature rather than naming any effect itself. Resumable fallbacks continue; panic is the abortive process-termination fallback. Deliberately NOT delegated to _with_host_value through an adapter closure: a closure captures its effect capabilities at CREATION, and any adapter made here would capture before these fallbacks exist. The handler set is duplicated below instead.

View Source
pub func _with_host(consume body: Task) -> () {
	#handle 'io { request in
		'continue _io_host(request: request)
	}
	#handle 'alloc { allocation in
		'continue
	}
	#handle 'yield {
		'continue
	}
	#handle 'panic { message in
		write_string(fd: STDERR_FD, s: message)
		write_string(fd: STDERR_FD, s: "\n")
		_io_host(request: .exit(1))
		loop {}
	}
	// The blocking wait fallback (ADR 0067/0068): register every
	// reason, block the worker, unregister, and continue. A resumed
	// operation re-checks its sources, so a spurious wake just waits again.
	#handle 'wait { reasons in
		_block_wait(reasons: reasons)
		'continue
	}
	_run_cooperative(root_task: body)
}