[fpc-pascal] += property bug?
James Richters
james at productionautomation.net
Wed Aug 14 20:53:12 CEST 2019
I have only used += once; I normally would not use I:=I+1; or I+=1; I would use Inc(I);
FPC does not compile I+=1; by default, you have to go into compiler options and turn on C-Like operators.. I'm sure Lazarus turns this on by default, but it's not the normal default for just FPC. I know it is not the default because I just installed FPC and if would not compile the exactly 1 instance I used += until I went in and turn on C-Like operators.
As far as typing code goes, I find all the begin's and end's to take more effort than anything else... but I can type a block of
Begin
End
Else
Begin
End;
Super fast now anyway... and I find that I defiantly PREFER to make the effort because the code is much more readable than things like python that don't use anything but indentation or C that uses the {} braces.. I find it so much easier to follow after the fact having begin and end than trying to follow a huge chain of braces which blend in way too easily with parenthesis (). Also most coding has more to do with cutting and pasting than actually typing things out anyway. Readability after the fact is simply WAY more important than how many keyboard keys you need to hit to get the code on the screen.
James
-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Rainer Stratmann
Sent: Wednesday, August 14, 2019 12:33 PM
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Subject: Re: [fpc-pascal] += property bug?
On Mittwoch, 14. August 2019 18:24:40 CEST Michael Van Canneyt wrote:
> 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.
Didn't you know that Ryan?
> 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.
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list