open

Implements open/3,4: validates the SourceSink/Mode/Stream/Options arguments (third is the Stream output argument, shared by both arities), opens the corresponding channel via it.unibo.tuprolog.solve.libs.io.openInputChannel/it.unibo.tuprolog.solve.libs.io.openOutputChannel, and registers it (under the alias(_) option, if given, or an auto-generated one) before replying with the new $stream(...) term unified with third.

Throws

if SourceSink, Mode or Options is unbound.

(source_sink, io_mode, stream_property) if SourceSink is not a valid Url, Mode is not read/write/append, or an element of Options is not a stream_property/2 shape.

if the resource cannot be opened for any other reason (e.g. writing attempted on a non-file Url).

(source_sink) if the resource does not exist.