Re: Strange behavior of "=" as assignment operator

From: Chris Travers <chris(dot)travers(at)gmail(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Strange behavior of "=" as assignment operator
Date: 2013-06-01 10:01:54
Message-ID: CAKt_ZftJzWj-FqE6DKrdkor4F+Pg2L32P9NLHf7w1swakYGymg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jun 1, 2013 at 2:52 AM, David Johnston <polobo(at)yahoo(dot)com> wrote:

> Chris Travers-5 wrote
> > However = as assignment is particularly odd to me for two reasons. First
> > it is not ambiguous but it leads to difficult to read constructs, like
> > this:
> >
> > out_var = in_left = in_right;
>
> Agreed but the genie is already out of the bottle and I am OK with
> something
> at the "lint/check_function" level trying to enforce good coding habits as
> opposed to changing the language to prohibit what has now been allowed for
> many years.
>

My preference would be that at some point we start adding warnings when =
is used as an assignment. Such warnings could be turned off. Then at some
later point we can decide whether to change the behavior. A decision to
changing the language would be different if such behavior had given
warnings for several years prior.

Best Wishes,
Chris Travers

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2013-06-01 12:25:41 Re: Strange behavior of "=" as assignment operator
Previous Message David Johnston 2013-06-01 09:52:23 Re: Strange behavior of "=" as assignment operator