[fpc-devel] C style operator doesn't work with properties in 2.3.1

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Jul 17 08:48:29 CEST 2008


On Wed, Jul 16, 2008 at 5:37 PM, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
> Indeed. I've checked the code and properties are explicitly not allowed for
> the C-style operators. The reason is that the x+=y is translated into
> "x:=x+y" at the parser level rather than at the lexical level. This means
> that in case x is a property, at the point that this transformation is
> performed the compiler already resolved it into the setter property (so it
> can no longer access the getter).

Sorry if the following sounds stupid, but I'm a applications
developer, not a compiler developer. I do not know or understand the
internals of a compiler.

So is what you mentioned above by design, or an oversight?  In normal
code like "x := x+y"  you are allowed to use properties or variables.
So surely the += operator which translates to "x := x+y" should also
be allowed to use properties.

We spoke earlier in another thread about hidden exceptions (rules)
which will just complicate things in the long run. Well to me, this
looks like one of those exceptions which the FPC core would like to
prevent.


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list