[fpc-pascal] class property accessor static
nc-gaertnma at netcologne.de
Tue Feb 7 13:51:53 CET 2017
On Tue, 7 Feb 2017 13:25:16 +0100
Maciej Izak <hnb.code at gmail.com> wrote:
> 2017-02-07 13:11 GMT+01:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:
> > Sorry, I don't get it.
> > Why is using a static method as accessor an advantage?
> You can use Get/Set pair of static methods in "property" form. Might be
> more handy.
Why is that "more handy"? "static" does not have a Self. That
is less handy, isn't it?
> > > and second: will work for improper implemented code ;)
> > > (which is maybe disadvantage?):
> > >
> > > TFoo($1).F;
> > > TFooClass($1).F;
> > I don't see why these calls require static instead of normal.
> In other scenario (for normal "property") this call will raise AV.
I can't follow you here. Are we still talking about why Delphi choose
static instead of normal?
> btw. "class property" is probably slightly faster ;) because don't pass
> "self" parameter.
OTOH you loose some possibilities.
More information about the fpc-pascal