[fpc-devel] += with properties

Alexander Klenin klenin at gmail.com
Wed Jan 12 16:48:32 CET 2011


On Wed, Jan 12, 2011 at 21:24, Michael Schnell <mschnell at lumino.de> wrote:
> += does work for variables, even Strings.
>
> AFAIR, there already has been a discussion about += and friends for
> properties.
>
> In fact I don't see why the compiler not just generates "x.a := x.a + y"
> from "x.a += y" before doing any code generating, disregarding what x.a is.
> Of course an error message will occur if x.a is not writable for any reason.
>

Blindly replacing "a += b" with "a := a + b" may lead to a semantic change
if "a" is an expression with side-effects.
Nevertheless, I do think that implementing += for properties is a good idea,
but unfortunately FPC developers disagree.

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list