[fpc-pascal] += property bug?
Jean SUZINEAU
Jean.Suzineau at wanadoo.fr
Thu Aug 15 00:39:46 CEST 2019
Le 14/08/2019 à 23:18, Martin a écrit :
> inc(CALL_LVL [ LOCAL_CALL ],1)
>
> Yes, "inc" does not work for properties. But neither does +=.
I agree and in the case of a property I think it would be cleaner to
code an Inc method directly in the class, or eventually in a class
helper, to write something like:
CALL_LVL [ LOCAL_CALL ].Inc(1)
In case of property, it's likely that you'll even be able to optimize
the code, trimming some lines of the getter and the setter in you Inc
method.
This said, I like to use += when I code in C++ for Arduino
I also think to the worse case, in Java, when you need to type something
like a.SetX( a.GetX()+1) ...
And to Python, where in the code of the methods I need to prefix all
accesses to methods and attributes of the object with "self." I have
some code self. self. self. everywhere ...
Variant in Javascript: this. this. this.
Variant in PHP: $this. $this. $this.
Yes, I keep my FreePascal ;-)
More information about the fpc-pascal
mailing list