bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Gawk 3.1.3 now available


From: Stepan Kasal
Subject: Re: Gawk 3.1.3 now available
Date: Wed, 13 Aug 2003 10:24:20 +0200

[This message has also been posted.]
[for bug-gnu-utils archives: this is only a vague wish, no bug here]

Hello Peter and all,

On Wed, 13 Aug 2003 01:58:26 +0100, Peter S Tillier wrote:
> To me it is clearer without the if ()s and similar constructions are
> available in other languages which I use on a regular basis.  Such as:
> 
> SELECT
>    when-list [statement-list]
>    [when-list [statement-list]]
>    [OTHERWISE [statement-list]]
> END
> 
> I'd like gawk to be able to do this, clearly YMMV.

I agree with you.  This comes to my mind:

select (expr1) {
case [operator] exp:
case [operator] exp, [operator] exp, ... [operator] exp:
...
otherwise:
}

The when-list is a comma separated list of expressions, each optionally
preceded by a comparison operator.
So you can say:
        case == 3:
        case > 5:
or
        case ~ /foo/:
or eg.
        case !~ "a/b/c":

If the operator is omitted, it should be treated as if == were given.

In case of
        case /foo/:
gawk would issue a warning that this is equivalent to
        case == ($0 ~ /foo/):
and that this form is discouradged.

I wouldn't introduce `break' here.  I think the comment comparing
fallthrough to break was right.

Peter, Aharon, and all other, how do you like it?

Regards,
        Stepan

PS: I'm not sure how much of this proposal comes from my fragment
memories to SQL and how much is original.  I hope it's not patented.  ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]