=title Terminal::Print
Synopsis
Terminal::Print implements an abstraction layer for printing characters to terminal screens with full Unicode support and -- crucially -- the ability to print from concurrent threads. The idea is to provide all the necessary mechanical details while leaving the actual so called 'TUI' abstractions to higher level libraries.
Obvious applications include snake clones, rogue engines and golfed art works :)
Oh, and Serious Monitoring Apps, of course.
Usage
Terminal::Print creates you an object for you when you import it, stored in
$Terminal::Print::T
. It also creates a constant T
for you in the OUR::
scope.
Thus common usage would look like this:
T.initialize-screen;
T.print-string(20, 20, DateTime.now);
T.shutdown-screen;
Miscellany
Where are we at now?
All the features you can observe while running perl6 t/basics.t
work using
the new react/supply based Terminal::Print::Grid. If you run that test file,
you will notice that Terminal::Print
is needing a better test harness.
Part of that is getting a STDERR
or some such pipe going, and printing state/
That will make debugging a lot easier.
Testing a thing that is primarily designed to print to a screen seems a bit difficult anyway. I almost think we should make it interactive. 'Did you see a screen of hearts?'
So: async (as mentioned above), testing, and debugging are current pain points. Contributions welcome.
Why not just use NativeCall and ncurses
?
I tried that first and it wasn't any fun. ncurses
unicode support is
admirable considering the age and complexity of the library, but it
still feels bolted on.
ncurses
is not re-entrant, either, which would nix one of the main benefits
we might be able to get from using Perl 6 -- easy async abstractions.