Re: Forth input line buffered, why?
- From: Elizabeth D Rather <erather@xxxxxxxxx>
- Date: Thu, 05 Mar 2009 22:08:40 -1000
celephicus wrote:
Greetings,
Forth, whether interpreting or compiling waits for the user to type
return before starting doing it's magic. Is there a reason for this,
apart from avoiding the output getting mixed up with the input?
The main reason is that it's often desirable to manage the input stream while you're in it. The most obvious way is simply by using the backspace or arrow keys to move around in the line at will before pulling the trigger. I would hate to be unable to backspace on the command line! There are other, more subtle, games that can be played with the input stream, but they are less common and less obvious.
I have in mind a strange implementation that tokenises while it is
accumulating input. Every time the tokeniser sees whitespace it spits
another word out. The rationale for doing this is to cut down the size
of the input buffer from 80 to 10 or so.
I have seen implementations that compile a command line before executing it, in order to be able to use things like IF and DO in the command line, but I think executing before the user is finished typing would be very hard to get used to.
If you're really that size-constrained, try shortening the buffer somewhat (e.g. 40 chars) but leave the logic the same.
Cheers,
Elizabeth
--
==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com
"Forth-based products and Services for real-time
applications since 1973."
==================================================
.
- Follow-Ups:
- Re: Forth input line buffered, why?
- From: Josh Grams
- Re: Forth input line buffered, why?
- References:
- Forth input line buffered, why?
- From: celephicus
- Forth input line buffered, why?
- Prev by Date: Forth input line buffered, why?
- Next by Date: Re: Forth input line buffered, why?
- Previous by thread: Forth input line buffered, why?
- Next by thread: Re: Forth input line buffered, why?
- Index(es):
Relevant Pages
|