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:
+World.print [ +World Str -- +World ] will output a string followed by a newline to stdout
+World.print- [ +World Str -- +World ] is the same as print but it doesn't append a newline.
+World.print(f) [ (*a +World +Str -- *b +World +Str) *a +World -- *b +World ] is the same as print but it takes a string-building word f as parameter. E.g. print(10 show; " -> "; 20 show;) will output "10 -> 20" followed by a newline, to stdout.
+World.trace is the same as print but to stderr instead of stdout.
+World.trace- is the same as print- but to stderr instead of stdout.
+World.trace(f) is the same as print(f) but to stderr instead of stdout.
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.
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:+World.print [ +World Str -- +World ]
will output a string followed by a newline to stdout+World.print- [ +World Str -- +World ]
is the same asprint
but it doesn't append a newline.+World.print(f) [ (*a +World +Str -- *b +World +Str) *a +World -- *b +World ]
is the same asprint
but it takes a string-building wordf
as parameter. E.g.print(10 show; " -> "; 20 show;)
will output "10 -> 20" followed by a newline, to stdout.+World.trace
is the same asprint
but to stderr instead of stdout.+World.trace-
is the same asprint-
but to stderr instead of stdout.+World.trace(f)
is the same asprint(f)
but to stderr instead of stdout.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
tostd.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.