Re: PSQL commands: \quit_if, \quit_unless

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: PSQL commands: \quit_if, \quit_unless
Дата
Msg-id alpine.DEB.2.20.1611300828580.13369@lancre
обсуждение исходный текст
Ответ на Re: PSQL commands: \quit_if, \quit_unless  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello Tom,

> But really, \fi is something that could only be loved by a certain 
> academic breed of hackers.

Ah ah:-) I'll take that as a compliment:-)

> I'd go for \endif, probably. That still doesn't relate well with 
> \unless, so +1 for \if, \ifnot, \else, and \endif.

Ok, that is a clear opinion.

> I'm not really convinced that we need an \elseif at this point.
> It could be added later if people find it compelling, but I'm
> having a hard time believing that it's essential.

My experience with cpp is that #elif is quite useful in some cases, 
typically with alternate implementations depending on dependences, to 
avoid this:
 #ifdef HAVE_XXX   ... #else #ifdef HAVE_YYY   ... #else #ifdef HAVE ZZZ   ... #else #error "oops!" #endif // HAVE_ZZZ
#endif// HAVE_YYY #endif // HAVE_XXX
 

I think that some realistic use cases examples for psql would be great...

If the else-if is a common pattern then it should be at least in the 
design, even if not implemented right away. Also ISTM that having else-if 
is not too compatible with multiplying \if* because it leads to pretty 
ugly \el*if* variants which are quite hard to parse and understand, so 
there is an impact on the design.

-- 
Fabien.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Random number generation, take two
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013