Some assumptions of Weave is that there is a single consumer of a future result (Flowvar or Pending) and that it tried to consume that result only once.
While we can't prevent the latter at compile-time, we can prevent the first by only allowing the sink/move operation on the type and making copies a compile-time error:
type
Flowvar[T] = object
proc `=`[T](dst: var Flowvar[T], src: Flowvar[T]) {.error: "copying not allowed".}
proc newFlowvar(T: typedesc): Flowvar[T] =
discard
let x = newFlowvar(int)
Some assumptions of Weave is that there is a single consumer of a future result (Flowvar or Pending) and that it tried to consume that result only once.
While we can't prevent the latter at compile-time, we can prevent the first by only allowing the sink/move operation on the type and making copies a compile-time error:
However we get unresolved generic parameter at the moment due to upstream bug https://github.com/nim-lang/Nim/issues/14315