Skip to content
Playground(another site)

bynk.types.stream_at_boundary

Error A Stream type, or a record or sum carrying one in a field, appears in a storable or boundary-crossing position — a stream is a live value-over-time source, never persisted or sent across a boundary (real-time track slice 0; #2623 admits it in capability signatures and record fields).

A Stream[T] is a live, lazily read source, built and consumed where it is made. It cannot be persisted or serialised, so it cannot be a service or agent handler parameter or result, a store field or an event field, nor can a record or sum that carries one in a field, at any depth. Drain it with collect() and send or keep the resulting List. A capability operation may take or return a stream, since its provider runs in the caller's own isolate, and a @raw HTTP handler's body may be a Stream[Bytes], the request body as it arrives.

Example

service s {
on call(readings: Stream[Int]) -> Effect[Int] by Caller { // ✗ a stream cannot be a parameter
Effect.pure(0)
}
}
service s {
on call(readings: List[Int]) -> Effect[Int] by Caller { // ✓
Effect.pure(readings.length())
}
}

In the Book

See also

  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.stream_at_boundary shows the same from the installed toolchain, without a network.