Re: No exceptions?
Date: Thu, 29 Jun 2006 17:35:03 GMT
paul c wrote:
> This little puzzle is prompted by my distaste for exceptions. In a
> language such as TTM Algebra, I wonder if they can be avoided in theory.
> By 'avoided' I mean in the sense of avoiding direct language support
> for them - an implementation might prefer to give ways to detect them
> outside of specific language syntax. (Whether one wants to avoid
> exceptions is a different question than whether one can avoid them.)
> 1) Syntax exceptions - An expression "x join y" might be a valid syntax
> but one such as "x y" might not. An implementation could stipulate that
> the reason it's not is because it is not an element of the domain for
> expressions in the chosen language given a particular syntax. If we
> have a way to test membership of such a domain, the syntax error could
> be indicated by the value "false" given by a boolean function. (One
> such way might be for all statements in a language to be treated as
> propositions of a relation that describes some program unit.)
> 2) Semantic exceptions - "x join y" might be valid syntax but "x" might
> be undefined, eg., there is no relation named "x".
> However, the interpretation of a language could be defined such that the
> mention of "x" without any collateral description stands for a relation
> with no attributes. According to Hugh Darwen, there are (only) two such
> relations, aka DEE and DUM and each must have a value (since each is a
> relation). Although their values are hard to write down, he does say
> (eg., at http://www.dbdebunk.com/page/page/1043196.htm) that DEE has one
> Within the TTM logical framework (and others), the Closed World
> Assumption is a convention that says an unmentioned fact is false, ie.,
> if the extension of a relation has no tuples, there are no propositions
> that satisfy that relation's predicate. This seems to me to provide a
> way around the non-determinism of "x join y" in isolation. Is it
> reasonable for a language (again, in theory) to interpret the lack of an
> extension for "x" as standing for DUM?
> There could be operational exceptions such as "out of memory" but before
> examining them, I'd appreciate comments on the above, especially as to
> whether I'm not applying the CWA correctly.
The way to avoid exceptions is to treat them as compile-time errors. Received on Thu Jun 29 2006 - 19:35:03 CEST