On Thu, 24 Jun 2004, sad wrote:
> > then lots of currently perfectly correct
> > programs break. If they're the same, then ELSE has different meanings
> > depending on whether NULL is specified, and that's generally bad from an
> > understanding the language standpoint.
>
> i've already thougth on this
> new control structure needed
> but the name of the IF is perfect %-)
I was thinking that something like Cs switch might work. There's still a
question of the keywords because I don't like reusing case, but maybe
something of the general form:case foo is true is false is null
The general form looks more like:
case <expression> [when <expression>] then <statements> [is (true | false | null)] then <statements> [else]
<statements>endcase
With (unthoughtout) semantics likeThe case expression is evaluated once (although the below describes things in terms
ofexpressions of the case expression, it is meant to be indicative of the intent not the actual implementation)Each
when/is/elseclause is evaluated in order as follows: For a when clause, if the value of the case expression is equal
tothe value of the when expression the statements are run and the case is ended. For an is clause, IS TRUE: if case
expressionIS TRUE is true then the statements are run and the case is ended IS FALSE: if case expression IS FALSE is
truethen the statements are run and the case is ended IS NULL: if case expression IS NULL is true then the
statementsare run and the case is ended For an else clause, run the statements (since no preceding condition has
succeeded)
This is basically an extension of the syntax and semantics of one
of the case expression. I don't think the above works keyword-wise
possibly, but it might be a reasonable starting point.