Handbook
Glossary
throw-on-eof ( ..a quot: ( ..a -- ..b ) -- ..b )
Throwing exceptions on stream exhaustion
Prev:
stream-throw-on-eof ( ..a stream quot: ( ..a stream' -- ..b ) -- ..b )
Next:
stream-exhausted ( n stream word -- * )
Vocabulary
io
.
streams
.
throwing
Inputs
quot
a
quotation
Outputs
None
Word description
Wraps the value stored in the
input-stream
variable and causes a stream read that exhausts the input stream to throw a
stream-exhausted
exception. The stream is left open after this combinator returns.
This example will throw a
stream-exhausted
exception:
USING: io.streams.throwing prettyprint ; "abc" [ [ 4 read ] throw-on-eof ] with-string-reader
Definition
USING:
io
kernel
namespaces
;
IN:
io.streams.throwing
:
throw-on-eof
( ..a quot: ( ..a -- ..b ) -- ..b )
[
input-stream
get
<throws-on-eof-stream>
]
dip
with-input-stream*
;
inline