From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PSQL commands: \quit_if, \quit_unless |
Date: | 2016-11-30 12:47:45 |
Message-ID: | b8a3179f-6606-d740-f52f-0ba302483669@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 11/30/2016 03:47 AM, Fabien COELHO wrote:
>
> Hello Andrew,
>
>>> I cannot remember a language with elseif* variants, and I find them
>>> quite ugly, so from an aethetical point of view I would prefer to
>>> avoid that... On the other hand having an "else if" capability makes
>>> sense (eg do something slightly different for various versions of
>>> pg), so that would suggest to stick to a simpler "if" without
>>> variants, if possible.
>>
>> FTR I *strongly* disagree with this. (And if you can't remember a
>> language that comes with them then you need to get out more. The
>> Bourne shell, where it's spelled "elif", and Ada are two obvious
>> examples.)
>
> There may be a misunderstanding somewhere.
>
> I'm rather in favor of having "elif/elsif/elseif/..." constructs,
> especially if they can be useful in realistic examples, which is not
> clear yet for psql scripts.
>
> I'm arguing against "if/elif" *variants* in the sense of various
> conditional semantics: e.g. in cpp you have several "if"s (ifdef
> ifndef if), but you do not have all the corresponding "elif"s (elifdef
> elifndef...), there is only one "elif". In cpp "ifdef"/"ifndef" were
> obsoleted by "if" with minimal expression support (#if
> !defined(HAS_SOMETHING) ...) and only this "if" has its "elif".
>
Oh, I see. Sorry for the misunderstanding.
I agree about generally sticking with one pattern, but I wouldn't want
to exclude shorthand pieces like
\quit_if cond
which could be more convenient than
\if cond
\quit
\endif
c.f. perl's "foo if bar;" as shorthand for "if (bar) { foo; }"
Still, that might be a refinement to add later on.
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2016-11-30 12:59:44 | Re: Radix tree for character conversion |
Previous Message | Alvaro Herrera | 2016-11-30 12:38:04 | Re: patch: function xmltable |