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

Re: read in es



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

i'm not sure i agree with that (though you do seem to have the syntax down
just fine).  i think it would be problematic to have an uncaught eof coming
out of a read terminating the shell's repl.

it was my intention when i first wrote the shell/repl mechanism that the
eof exception only be used for repl termination.  (of course, you can just
throw one any time you feel like.)  now that's not saying that read should
not throw an exception;  i had imagined it returning an empty list for eof,
as opposed to a zero-length string for empty input.  for example,

	; while {} {
		let (x = <={%read 'foo> '}) {
			if {~ $#x 0} {
				break
			}
			echo 'You said, "'$x'."'
		}
	}
	foo> hello, world
	You said, "hello, world."
	foo> 
	You said, "."
	foo> ^D
	; 

opinions?  should %read throw an exception or return a 0-length list?

paul