mirth-lang / mirth

Compiler for the Mirth programming language.
BSD Zero Clause License
447 stars 14 forks source link

Remove print! and trace! and similarly impure words. #295

Closed typeswitch-dev closed 6 months ago

typeswitch-dev commented 6 months ago

We should not be using functions that produce output without using the +World resource (or a +File resource).

As part of this I introduce +World.print and +World.trace, as the new preferred ways to produce output on stdout and stderr respectively. Here's a summary:

These also replace the +World.put and +World.line functions. So now the "Hello, world!" example becomes "Hello, world!" print instead of "Hello, world!" put line.

I also renamed std.posix to std.world.

In addition I also introduce +World.stdin(f), +World.stdout(f), +World.stderr(f) which give temporary input/output streams to those file handles. These are intended for more long-lived interactions, because they use a fixed size backing buffer.