On Wed, 30 Mar 2022 19:50:12 +0800, David Crayford wrote:
>>
>> That may well be. I stand by my claim that it is a common source of errors.
>
>I agree. Which is why a lot of C programmers used to used to code if
>statements with no lvalues:
>
>if (3 = foo) ...
>
A similar practice applies to Shell test. Code:
if [ 3 = $foo ] ...
rather than:
if [ $foo = 3 ] ...
lest $foo evaluate to a unary operator. The habit of writing the constant on
the
right may come from natural languages where "is" can denote either identity
or set membership.
I favor ":=", a typographically asymmetric operator for a semantically
asymmetric operation.
It's unfortunate that ASCII doesn't contain "←". Some languages assign
rightward -- "GIVING or "→".
--
gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN