Re: Strange behavior of "=" as assignment operator - Mailing list pgsql-general

From Chris Travers
Subject Re: Strange behavior of "=" as assignment operator
Date
Msg-id CAKt_ZftJzWj-FqE6DKrdkor4F+Pg2L32P9NLHf7w1swakYGymg@mail.gmail.com
Whole thread Raw
In response to Re: Strange behavior of "=" as assignment operator  (David Johnston <polobo@yahoo.com>)
Responses Re: Strange behavior of "=" as assignment operator
List pgsql-general



On Sat, Jun 1, 2013 at 2:52 AM, David Johnston <polobo@yahoo.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

pgsql-general by date:

Previous
From: David Johnston
Date:
Subject: Re: Strange behavior of "=" as assignment operator
Next
From: Pavel Stehule
Date:
Subject: Re: Strange behavior of "=" as assignment operator