← index

[IO]Handle

inherits Object

One of the process's three standard streams: stdout, stderr, or stdin.

The prelude binds the write handles as the constants [IO]Stdout and [IO]Stderr ([IO]Stdout.writeln:'hi' is the everyday print); reading belongs to [IO]Stdin. Writes to stdout/stderr are routed through the VM, so ANSI color is stripped when the terminal doesn't support it and a debugger can capture program output cleanly.

Class methods

stderr

The standard-error handle — normally reached through the prelude constant [IO]Stderr.

native

stdin

The standard-input handle. It is read-only: write: / writeln: throw, and reading goes through stringStream / byteStream — or, more directly, the [IO]Stdin class.

native

stdout

The standard-output handle — normally reached through the prelude constant [IO]Stdout.

native

Instance methods

==:

Whether the argument is a handle on the same standard stream (any two stdout handles are equal). A non-handle argument is simply unequal.

[IO]Stdout == [IO]Handle.stdout     "* -> true

native

byteStream

The one shared ByteStream over standard input (stdin only — the write handles throw an IoError). Mutually exclusive with the text view: stdin buffers, so it is one stream or the other for the whole program.

native

s

Which handle this is, as its constructor expression.

[IO]Stdout.s     "* -> '[IO]Handle.stdout'

native

stringStream

The one shared StringStream over standard input (stdin only — the write handles throw an IoError). Reads park the task, not the scheduler; the stream is created on first use and reused, exactly as [IO]Stdin.stream describes.

native

write:

Write a String (or an ANSI color expression) to the handle, without a trailing newline. ANSI codes are stripped when the output doesn't support color; writing to the stdin handle throws an IoError. Returns nil.

native

writeln:

write: plus a trailing newline — [IO]Stdout.writeln:'hello' is the everyday print statement. Returns nil.

native