Re: [fpc-devel] Class property and virtual getter

2014-05-28 Thread Michael Schnell
On 05/26/2014 08:25 PM, Sven Barth wrote: Here... happy now? ;) Very happy indeed :-) . (Silly me did not remember the ClassName property. With same the test is as easy as you showed.) Now thinking about why I had been confused is that obviously self of an instance _does_ determine the

Re: [fpc-devel] Class property and virtual getter

2014-05-28 Thread Michael Van Canneyt
On Wed, 28 May 2014, Michael Schnell wrote: On 05/26/2014 08:25 PM, Sven Barth wrote: Here... happy now? ;) Very happy indeed :-) . (Silly me did not remember the ClassName property. With same the test is as easy as you showed.) Now thinking about why I had been confused is that

Re: [fpc-devel] Class property and virtual getter

2014-05-28 Thread Mattias Gaertner
On Wed, 28 May 2014 09:27:42 +0200 Michael Schnell mschn...@lumino.de wrote: On 05/26/2014 08:25 PM, Sven Barth wrote: [...]I wonder if the dynamic instance record has a just a pointer to the VMT of the class or if the classes VMT gets copied when creating an instance. The VMT is part of

Re: [fpc-devel] Class property and virtual getter

2014-05-26 Thread Michael Schnell
I found out that I need to add static to the get class procedure to allow it's usage in a class property. Sorry for the noise :-[ If fact I don't understand what the additional static is necessary. I was of the op pinion that class procedures are static, anyway. Can somebody clarify ?

Re: [fpc-devel] Class property and virtual getter

2014-05-26 Thread Ewald
On 26 May 2014, at 11:04, Michael Schnell wrote: I found out that I need to add static to the get class procedure to allow it's usage in a class property. Sorry for the noise :-[ If fact I don't understand what the additional static is necessary. I was of the op pinion that class

Re: [fpc-devel] Class property and virtual getter

2014-05-26 Thread Michael Schnell
On 05/26/2014 12:52 PM, Ewald wrote: A `Class Procedure/Function XXX;` has a hidden parameter that points to the classtype. A `Class Procedure/Function XXX; static;` doesn't have this hidden parameter. I see. The hidden parameter would be accessed as Self ? Thanks for the explanation !

Re: [fpc-devel] Class property and virtual getter

2014-05-26 Thread Ewald
On 05/26/2014 01:04 PM, Michael Schnell wrote: On 05/26/2014 12:52 PM, Ewald wrote: A `Class Procedure/Function XXX;` has a hidden parameter that points to the classtype. A `Class Procedure/Function XXX; static;` doesn't have this hidden parameter. I see. The hidden parameter would be

Re: [fpc-devel] Class property and virtual getter

2014-05-23 Thread Michael Schnell
On 02/27/2014 04:35 PM, Jonas Maebe wrote: You have to declare an instance and then call its property. You don't have to instantiate the instance if the property maps to a class method. Technically there's some obstacle to allow such construct? Class properties should be accessible from

Re: [fpc-devel] Class property and virtual getter

2014-02-28 Thread Michael Schnell
On 02/28/2014 02:18 AM, Hans-Peter Diettrich wrote: So the lack of Self seems to apply to static; methods, not to class methods. I'll ask in an EMBT group for a description of static;, the OH seems to reflect the C++ meaning only, In ANSI C static with functions just means unreachable from

Re: [fpc-devel] Class property and virtual getter

2014-02-28 Thread Sven Barth
Am 28.02.2014 09:12 schrieb Michael Schnell mschn...@lumino.de: On 02/28/2014 02:18 AM, Hans-Peter Diettrich wrote: So the lack of Self seems to apply to static; methods, not to class methods. I'll ask in an EMBT group for a description of static;, the OH seems to reflect the C++ meaning

Re: [fpc-devel] Class property and virtual getter

2014-02-28 Thread Hans-Peter Diettrich
Michael Schnell schrieb: On 02/28/2014 02:18 AM, Hans-Peter Diettrich wrote: So the lack of Self seems to apply to static; methods, not to class methods. I'll ask in an EMBT group for a description of static;, the OH seems to reflect the C++ meaning only, In ANSI C static with functions

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Michael Van Canneyt
On Thu, 27 Feb 2014, luiz americo pereira camara wrote: TSimpleModel = class(TPersistent)   protected     class function GetResourceClient: IResourceClient; virtual;     class property ResourceClient: IResourceClient read GetResourceClient;   public   end; Trying to compile the above code i

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Sven Barth
Am 27.02.2014 04:36, schrieb luiz americo pereira camara: TSimpleModel = class(TPersistent) protected class function GetResourceClient: IResourceClient; virtual; class property ResourceClient: IResourceClient read GetResourceClient; public end; Trying to compile the above code i

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Michael Van Canneyt
On Thu, 27 Feb 2014, Hans-Peter Diettrich wrote: Sven Barth schrieb: Changing the GetResourceClient method from virtual to static works Is this a bug or by design? As Michael said this is by design. If you want to use a non-static class procedure you must not use class property, but only

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread luiz americo pereira camara
2014-02-27 5:25 GMT-03:00 Sven Barth pascaldra...@googlemail.com: Am 27.02.2014 04:36, schrieb luiz americo pereira camara: Is this a bug or by design? As Michael said this is by design. If you want to use a non-static class procedure you must not use class property, but only property

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Hans-Peter Diettrich
Michael Van Canneyt schrieb: So what's the special use of a *class* property? If it exists for Delphi compatibility only, why then is it handled differently from property? The reason is explained in the upcoming docs. Namely: a static method cannot be overridden. Sure, but virtual methods

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Michael Van Canneyt
On Thu, 27 Feb 2014, Hans-Peter Diettrich wrote: Michael Van Canneyt schrieb: So what's the special use of a *class* property? If it exists for Delphi compatibility only, why then is it handled differently from property? The reason is explained in the upcoming docs. Namely: a static

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Jonas Maebe
On 27 Feb 2014, at 12:40, luiz americo pereira camara wrote: Removing class before property compiles. But if i try to access the property using TSimpleModel.ResourceClient gives the following error: Error: Only class methods, class properties and class variables can be referred with class

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread luiz americo pereira camara
2014-02-27 12:35 GMT-03:00 Jonas Maebe jonas.ma...@elis.ugent.be: On 27 Feb 2014, at 12:40, luiz americo pereira camara wrote: Technically there's some obstacle to allow such construct? Class properties should be accessible from within static class methods. Got it. Thanks Luiz

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Sven Barth
Am 27.02.2014 15:35, schrieb Hans-Peter Diettrich: Also self is no more known inside class methods in XE. In D7 it was the class type instead of the instance pointer. Thus a too restrictive compiler, geared towards compatibilitiy with *new* Delphi versions, may break existing code. Source

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Hans-Peter Diettrich
Michael Van Canneyt schrieb: The reason is explained in the upcoming docs. Namely: a static method cannot be overridden. Sure, but virtual methods (including class methods) can be overridden. The class property is part of this particular class, and descendent classes should not be able to

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Hans-Peter Diettrich
Sven Barth schrieb: Am 27.02.2014 15:35, schrieb Hans-Peter Diettrich: Also self is no more known inside class methods in XE. In D7 it was the class type instead of the instance pointer. Thus a too restrictive compiler, geared towards compatibilitiy with *new* Delphi versions, may break

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Hans-Peter Diettrich
Jonas Maebe schrieb: Error: Only class methods, class properties and class variables can be referred with class references You have to declare an instance and then call its property. You don't have to instantiate the instance if the property maps to a class method. Technically there's

Re: [fpc-devel] Class property and virtual getter

2014-02-27 Thread Sven Barth
On 28.02.2014 02:18, Hans-Peter Diettrich wrote: Sven Barth schrieb: Am 27.02.2014 15:35, schrieb Hans-Peter Diettrich: Also self is no more known inside class methods in XE. In D7 it was the class type instead of the instance pointer. Thus a too restrictive compiler, geared towards

[fpc-devel] Class property and virtual getter

2014-02-26 Thread luiz americo pereira camara
TSimpleModel = class(TPersistent) protected class function GetResourceClient: IResourceClient; virtual; class property ResourceClient: IResourceClient read GetResourceClient; public end; Trying to compile the above code i get the following error: Error: Illegal symbol for property