Hi Tomas,

> I would expect 'char' to block and return next character when
> available and 'peek' return the next character if available otherwise
> return "nothing" without blocking.

On that level there is no concept of blocking. Data are read as a
logical stream. Something similar to what you suggest might be achieved
with 'poll', but not completely, and probably not in our case.

'peek' returning "nothing" would have a different meaning. For "normal"
operations I *do* it want to block, until I receive all data.


> I guess it seems broken to me because of the two char lookahead in
> 'char', but is it necessary?  Is it "only" to handle different line
> endings?

'char' has to cooperate with 'read', 'line', 'till', 'skip, etc. And the
logic behind these functions (most notably 'read') require that
internally there is always a single-character lookahead, and thus one
more character read than necessary.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to