Re: [fpc-pascal] class property accessor static

2017-02-08 Thread Luiz Americo Pereira Camara
2017-02-07 23:17 GMT-03:00 Paul Ishenin : > 07.02.2017 18:10, Mattias Gaertner wrote: > >> The getter/setter of a class-property must be "static" (Delphi >> compatible). >> If I understand "static" correctly, then "static" simply omits passing >> the class as parameter. So

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Paul Ishenin
07.02.2017 18:10, Mattias Gaertner wrote: The getter/setter of a class-property must be "static" (Delphi compatible). If I understand "static" correctly, then "static" simply omits passing the class as parameter. So a static class procedure is just a dumber version of a normal class procedure.

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Mattias Gaertner
On Tue, 7 Feb 2017 23:20:18 +0100 Sven Barth wrote: > Am 07.02.2017 19:59 schrieb "Maciej Izak" : > > > > > > 2017-02-07 19:49 GMT+01:00 Mattias Gaertner : > >> > >> In FPC static class methods can be virtual as well.

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Sven Barth
Am 07.02.2017 19:59 schrieb "Maciej Izak" : > > > 2017-02-07 19:49 GMT+01:00 Mattias Gaertner : >> >> In FPC static class methods can be virtual as well. > > > So we have bug... Indeed... Regards, Sven ___

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Maciej Izak
2017-02-07 19:49 GMT+01:00 Mattias Gaertner : > In FPC static class methods can be virtual as well. So we have bug... -- Best regards, Maciej Izak ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Mattias Gaertner
On Tue, 7 Feb 2017 19:23:52 +0100 Sven Barth wrote: >[...] > Oh and don't forget that non-static class methods can be virtual (sometimes > I really miss that in C++). In FPC static class methods can be virtual as well. Mattias

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Sven Barth
Am 07.02.2017 14:31 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > I never understood Object Pascal's class methods/properties either? > Unlike Java, not everything needs to be in a class. We are allowed to > have procedures or functions, and global ones at that. So in Object >

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Graeme Geldenhuys
On 2017-02-07 13:35, Mattias Gaertner wrote: > Class methods can be overridden. But then you would have to define a new type first. In that case you can simply have a instance variable too. Personally, it just doesn't make much sense to me in Object Pascal. But thanks for clarifying the

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Maciej Izak
2017-02-07 14:35 GMT+01:00 Mattias Gaertner : > > I never understood Object Pascal's class methods/properties either? > > Unlike Java, not everything needs to be in a class. We are allowed to > > have procedures or functions, and global ones at that. So in Object > >

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Mattias Gaertner
On Tue, 7 Feb 2017 13:31:10 + Graeme Geldenhuys wrote: >[...] > Couldn't that simply be > > Writeln(TFoo.F); Yes. > I never understood Object Pascal's class methods/properties either? > Unlike Java, not everything needs to be in a class. We are

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Graeme Geldenhuys
On 2017-02-07 13:19, Maciej Izak wrote: > "class property" is used for code where class instance (nor assign to meta > class) is not needed. Some variance/idea of singleton pattern. TFoo might > be used as namespace: > > ===code begin=== > var > Foo: TFooClass; // or Foo: TFoo > begin >

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Maciej Izak
2017-02-07 13:51 GMT+01:00 Mattias Gaertner : > Why is that "more handy"? "static" does not have a Self. That > is less handy, isn't it? > by "handy" I mean usage of "class properties" instead of "static methods". > I can't follow you here. Are we still talking about

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Mattias Gaertner
On Tue, 7 Feb 2017 13:25:16 +0100 Maciej Izak wrote: > 2017-02-07 13:11 GMT+01:00 Mattias Gaertner : >[...] > > 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

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Michael Van Canneyt
On Tue, 7 Feb 2017, Maciej Izak wrote: I don't see why these calls require static instead of normal. In other scenario (for normal "property") this call will raise AV. btw. "class property" is probably slightly faster ;) because don't pass "self" parameter. In other words, there is no

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Maciej Izak
2017-02-07 13:11 GMT+01:00 Mattias Gaertner : > That's an advantage of static methods. > But how is that related to class properties? > How can you use class properties with "methods designed for > callbacks from external API"? > Is not related. AFAIK "class property"

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Mattias Gaertner
On Tue, 7 Feb 2017 12:30:26 +0100 Maciej Izak wrote: > 2017-02-07 12:10 GMT+01:00 Mattias Gaertner : >[...] > Generally "static" means no hidden parameter "self". "static" for methods > is used for methods designed for callbacks from external API.

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Maciej Izak
2017-02-07 12:10 GMT+01:00 Mattias Gaertner : > The getter/setter of a class-property must be "static" (Delphi > compatible). > If I understand "static" correctly, then "static" simply omits passing > the class as parameter. So a static class procedure is just a dumber

[fpc-pascal] class property accessor static

2017-02-07 Thread Mattias Gaertner
Hi, The getter/setter of a class-property must be "static" (Delphi compatible). If I understand "static" correctly, then "static" simply omits passing the class as parameter. So a static class procedure is just a dumber version of a normal class procedure. What is the advantage of using "static"