Getch() Problem: C vs D

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 9 18:10:23 PST 2017


On Monday, 9 January 2017 at 23:33:45 UTC, Era Scarecrow wrote:
>  For direct interactions (a game menu or similar) getting 
> individual characters makes sense; I can't help but think 
> Rogue-likes. However for data input (per line basis) or doing 
> bulk data/processing, it doesn't work well.

Well, line processing depends on which level you're working on. 
My terminal.d includes a getline() function which gives the high 
level interface on a line level, but its implementation uses the 
individual events (and you can hook those for customization btw) 
because it allows the library to provide a much richer UX - line 
navigation with arrow keys, editing, insertion, etc.

Bulk I/O is a major win too, but with direct user interaction, 
the bottleneck is (almost always nowadays) the user's actual 
input - even quick typists are insanely slow sources of data as 
far as the computer is concerned. And there, being able to arrow, 
backspace, etc., is a huge productivity win for them and seeing 
the individual events gives the program the control it needs to 
make that work well.



More information about the Digitalmars-d-learn mailing list