[fpc-pascal] += property bug?

Bernd Oppolzer bernd.oppolzer at t-online.de
Wed Aug 14 23:05:28 CEST 2019


Am 14.08.2019 um 17:41 schrieb wkitty42 at windstream.net:
> On 8/14/19 10:54 AM, Ryan Joseph wrote:
>> Seriously? why is i := i + 1 better than i += 1 ? just more typing 
>> for such a
>> simple operation. All languages I use have adopted this syntax and 
>> for good
>> reason.
>
> good reason?? because someone is too lazy to type 4 more characters? 
> yes, i'm counting the readability spaces which could easily be left 
> out...
>
> /me tightens belt on asbestos britches...
>
>

4 characters in your case, but if you have for example:

CALL_LVL [ LOCAL_CALL ] := CALL_LVL [ LOCAL_CALL ] + 1 ;

and you write instead:

CALL_LVL [ LOCAL_CALL ] += 1;

it's more than 4 chars, and it's easier, when it comes to changes,
and and and ...

This is only a simple example; consider arrays with more indexes and
record components and pointer references ...

BTW: the two statements are not equivalent, if the index expression
contains for example a function call with side effects :-)

PL/1 is another language which has been enhanced to support this
notation some years ago.

Kind regards

Bernd



More information about the fpc-pascal mailing list