[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read in es



Two more cents on read.

Es already has it, as part of the REPL. We just can't get at it.  The proof
is that it raises the 'eof' exception.  Saying this shows us how read
should be used in a loop

	fn readloop test body {
		catch @e value {
			if (!~ $e eof) {
				throw $e $value
			}
			result 0
		} { while $test $body }
	}

	blah blah blah | readloop { read var } { code ... }

Even if I don't have the syntax down, the idea is to use the eof exception
to break the loop...

Arnold