Re: Boolean operators without commutators vs. ALL/ANY

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Boolean operators without commutators vs. ALL/ANY
Дата
Msg-id BANLkTinEXbWix57x7+wak65L45NHHozcEw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Boolean operators without commutators vs. ALL/ANY  (Florian Pflug <fgp@phlo.org>)
Ответы Re: Boolean operators without commutators vs. ALL/ANY  (Florian Pflug <fgp@phlo.org>)
Список pgsql-hackers
On Fri, Jun 17, 2011 at 3:49 PM, Florian Pflug <fgp@phlo.org> wrote:
>> The regex is always to the right of the operator.
>
> Which is something you have to remember... It's not in any
> way deducible from "foo ~ bar" alone.

Except that it's always been this way, going back to perl4 or tcl or
their predecessors. The regexp binding operator always has the regexp
on the right.


>>> How is that worse than the situation with "=~" and "~="?
>>
>> With =~ it is to the right, with ~= it is to the left.
>
> It's always where the tilde is. Yeah, you have to remember that.

And when you get it wrong it will fail silently. No errors, just wrong results.

While I've never accidentally written /foo/ =~ $_ in perl I have
*frequently* forgotten whether the operator is ~= or =~. Actually I
forget that pretty much every time I start writing some perl. I just
put whichever comes first and if I get an error I reverse it.

I can see the temptation to make it symmetric but it's going to cause
an awful lot of confusion.

Perhaps we could name the operators ~~= and =~~ and then have a =~
short-cut for compatibility? (and ~ too I guess?)


-- 
greg


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: pika buildfarm member failure on isolationCheck tests
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Patch - Debug builds without optimization