Yuval Kogman wrote:
On Wed, Sep 28, 2005 at 11:46:37 -0500, Adam D. Lopresto wrote:
The recent thread on Expectuations brought back to mind something I've been
thinking for a while. In short, I propose that "use fatal" be on by default,
that "err" be turned into syntactic sugar for a very small try/CATCH block.
I like it a lot. It gives the advantages of both the flexible, more
robust try/catch, and the (locally) concise, clear error return.
I don't like it at all. I fear, that we mix two orthogonal concepts
just because it is convenient.
To me the statement
return 42; # 1
has to orthogonal meanings:
1) the current scope has reached its (happy) end
2) a specific result was determined
We can vary on both of these dimensions *independently*!
Which gives the remaining three cases:
return undef; # 0 unspecific result
fail undef; # -1 no return with unspecific reason
fail 42; # -2 no return but determined reason
In other words an exception means
or in yet another way to describe my attitude: the least
thing that *defines* an exception is that the dynamic
scope in question has reached the conclusion that it
is *not* going to give control back to its creator!
Note that this somewhat pinpoints or controls the two infinities
of computing in time and storage. One either needs a block of infinite
length right away or handle control flow exceptions *on the outside*
to keep a finite scope going.
$TSa.greeting := "HaloO"; # mind the echo!