Event-driven camera capture
An IO space with full device lifecycle and fault recovery, no driver code.
@camFeed:IO
>>> Camera interface publishing raw JPEG frames.
>>> On %onEnter, trigger $io_reader(out=%jpgFrameStream).
>>> Each %sensorUpdate delegates to $decodeFrame(in=%jpgFrameStream).
>>> On %onError, delegate to $restartDevice.
>
$io_reader(out=%jpgFrameStream)
>>> Opens the camera and streams JPEG frames on %jpgFrameStream.
>>> Emits %sensorUpdate for every new frame delivered.
>
$decodeFrame(in=%jpgFrameStream, out=%rgbFrameStream)
>>> Converts incoming JPEG frames to RGB tensors.
>
$io_writer(in=%deviceResetCmd)
>>> Sends a reset command to the camera hardware.
>
$restartDevice()
>>> Issues %deviceResetCmd via $io_writer to recover from faults.
What this shows
Full device lifecycle. Automatic startup on %onEnter, fault recovery on %onError, and stream processing in between. No driver code, no buffer management, no manual lifecycle plumbing.
Streaming pipeline without imperative control flow. The :IO space declares “each new frame delegates to $decodeFrame” — the runtime implements the loop. The author never writes while True:.
Reusable recovery. $restartDevice is a small task whose only job is to emit %deviceResetCmd. Other error handlers can invoke the same task; the device-reset path is one place to audit.
Bridging device IO to higher-level processing. $io_reader produces %jpgFrameStream; $decodeFrame consumes it. Each task does one thing, and the connection is a named data resource the compiler verifies.