On Tuesday, 9 October 2012 at 14:03:36 UTC, monarch_dodra wrote:
I tend to disagree with your examples, because, you are mixing
the notion of run-time failure with logic error.
For example: "new" New can fail. And you don't know unless you
try.
But new will throw an exception to tell you it failed..
An appender, as you say, is finite in memory, and will end up
throwing an exception, yes. You also have a chance to try to
catch it and react.
Over-putting into a finite slice, on the other end, will
*assert*. Game over. It is a catch 22: You can't know unless
you try, you crash if you do.
Actually, OutOfMemoryError and AssertError are the same class of
Throwable - namely Error. They're both non-recoverable exceptions.
I agree that AssertError is not an appropriate type to throw if
an OutputRange is full, though.