darcsden :: alex -> the -> blob

the programming language

root / prelude / port.the

with-output-to: (fn: String) do: b :=
    Port (new: fn) ensuring: @close do: { file |
        with-output-to: file do: b
    }

with-output-to: (p: Port) do: b := {
    current-output-port = p
    join: b
} call

with-input-from: (fn: String) do: (b: Block) :=
    Port (new: fn) ensuring: @close do: { file |
        with-input-from: file do: b
    }

with-input-from: (p: Port) do: (b: Block) := {
    current-input-port = p
    join: b
} call