[fpc-pascal] += property bug?

Michael Van Canneyt michael at freepascal.org
Wed Aug 14 18:24:40 CEST 2019



On Wed, 14 Aug 2019, Ryan Joseph wrote:

>
>
>> On Aug 14, 2019, at 12:04 PM, Rainer Stratmann <rainerstratmann at t-online.de> wrote:
>> 
>>> It’s so
>>> intuitive that basically all languages have adopted the syntax.
>> 
>> That is not true
>
> All languages I use have them: Pascal, C, PHP, C#, Swift, Python, JavaScript. These are some of the most popular languages in the world right now. You’re fighting a losing battle sir.

I don't see what the issue is ?

You do have +=  and the like. They exist, since about as long as I can remember.

You just cannot use it on properties.

Properties have some other restrictions as well:

* You also cannot Use Inc() on integer properties, 
* or use Include()/Exclude() on set properties. 
* You also cannot do SomeRecordProp.X:=Y;
* or pass them to functions that require var arguments.

And I'm probably forgetting some other limitations.

The += is just another one in the list of limitations of properties.

Basically any operation that requires an address is not allowed.
That += is using an address is an implementation detail of the compiler.
Same as Inc() or In/Exclude(). I don't know the exact reason for this limitation,
but it's bound to be a good one, otherwise it would have been lifted a long time
ago...

And if someone doesn't like these limitations of properties, (s)he can use fields. 
No-one abolished those, after all.

Michael.


More information about the fpc-pascal mailing list