Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2014-09

RTTI generating

35 messages · 11 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adriaan van Os

This is a copy of a post on the macpascal mailing list, where it was suggested to re-ask on the fpc-devel list.

-----

The RTTI generating logic in the FPC compiler puzzles me ....

Chapter 40 of FreePascal Run-Time Library Reference guide describes the typinfo unit. It says

; The TypeInfo unit contains many routines which can be used for the querying of the Run-Time ; Type Information (RTTI) which is generated by the compiler for classes that are compiled under the ; {$M+} switch

Great so far !

; This information can be used to retrieve or set property values for published properties ; for totally unknown classes. In particular, it can be used to stream classes

This is what I fail to understand. Why is RTTI information tied to properties and why is it restricted to what is in the published/public sections of classes (or objects in macpas mode) ? For example, when I want to implement an object browser for debugging purposes, I want to see anything. What I am allowed in the code to do with the methods and fields is irrelevant and whether fields are properties or not is irrelevant too.

When I try it, $M+ refuses public non-property class fields. With $M- ClassInfo, GetTypeData and the ParentInfo field work. However, FieldAddress and MethodName do not work. The field count in the FieldTable field of the VMT is 0.

Is there a special reason why the compiler can't fill in the VMT's FieldTable ?

-----

Jonas Maebe replied that RTTI information has been implemented according to Delphi conventions. Marco van de Voort mentioned D2010 and work being done on the extended RTTI ($RTTI directive). Paul Ishenin remembered Joost implemented some prototype in a branch, that had some problems and was not merged to trunk yet.

Regards,

Adriaan van Os

Reply by email

Michael Van Canneyt
to Adriaan van Os
Adriaan van Os wrote 27 lines
This is a copy of a post on the macpascal mailing list, where it was suggested to re-ask on the fpc-devel list. ----- The RTTI generating logic in the FPC compiler puzzles me .... Chapter 40 of FreePascal Run-Time Library Reference guide describes the typinfo unit. It says ; The TypeInfo unit contains many routines which can be used for the querying of the Run-Time ; Type Information (RTTI) which is generated by the compiler for classes that are compiled under the ; {$M+} switch Great so far ! ; This information can be used to retrieve or set property values for published properties ; for totally unknown classes. In particular, it can be used to stream classes This is what I fail to understand. Why is RTTI information tied to properties and why is it restricted to what is in the published/public sections of classes (or objects in macpas mode) ?

Because the Delphi specs - at the time - said that RTTI is generated only for published sections.

For example, when I want to implement an object browser for debugging purposes, I want to see anything.

RTTI cannot be used for this, you need debug info for that.

RTTI is not a substitute for debug info.
Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object. It was/is not meant for that.

What I am allowed in the code to do with the methods and fields is irrelevant and whether fields are properties or not is irrelevant too.

Of course it is relevant. Properties may use getters, fields cannot.

RTTI is not restricted to property values.
It says "can be used to retrieve or set property values for published properties for totally unknown classes"

That implies that it can be used for other things as well (as indeed it is).

But only for published sections. Since RTTI cannot be generated for any type (a Delphi spec), the list of types that can be used in a published section is restricted. (basically, anything non-structured that fits in a pointer)

When I try it, $M+ refuses public non-property class fields. With $M- ClassInfo, GetTypeData and the ParentInfo field work. However, FieldAddress and MethodName do not work.

Can you post some sample code, because I do not understand these sentences ?

The field count in the FieldTable field of the VMT is 0. Is there a special reason why the compiler can't fill in the VMT's FieldTable ?

I think the compiler people need to confirm this, but I think the FieldTable is not used in FPC ? At least, I know of no use for this table, it probably exists for Delphi compatibility.

Show quoted text 5 lines
Jonas Maebe replied that RTTI information has been implemented according to Delphi conventions. Marco van de Voort mentioned D2010 and work being done on the extended RTTI ($RTTI directive). Paul Ishenin remembered Joost implemented some prototype in a branch, that had some problems and was not merged to trunk yet.

This is all correct.

Michael.

Reply by email

Boian Mitov
to Michael Van Canneyt
Adriaan van Os wrote
>>

Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object.
It was/is not meant for that.
<<<

Quite incorrect. All languages with modern RTTI allow for full object inspection, and that includes Delphi 2010 and higher, C#, and even VB has it.
The fact is that FPC is just stuck in the last century, and the lack of any even remotely decent RTTI in it makes it unsuitable for any modern development.
Our code nowadays relies nearly 100% on advanced RTTI, and it was one of the major factors, we decided to discontinue any attempts to support Lazarus.

If the Lazarus goal is to be just what D7 was ~12 or so years ago, fine, but then easier goal is to be just what Turbo Pascal was in the late 80s or even easier goal, just be an assembler.
The world has moved since 2000, and FPC seems to be downright stuck technology wise IMHO :-( .

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 13 lines
-----Original Message----- From: Michael Van Canneyt Sent: Friday, September 19, 2014 3:44 AM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating On Fri, 19 Sep 2014, Adriaan van Os wrote: Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object. It was/is not meant for that.

Reply by email

Jonas Maebe
to Boian Mitov
Boian Mitov wrote 12 lines
On Fri, 19 Sep 2014, Adriaan van Os wrote: >>> Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object. It was/is not meant for that. <<< Quite incorrect. All languages with modern RTTI allow for full object inspection, and that includes Delphi 2010 and higher, C#, and even VB has it. The fact is that FPC is just stuck in the last century,

Why do you take one paragraph out of context and base a whole rant on that which ignores the other information from the original message?

Jonas

Reply by email

silvioprog
to Boian Mitov: Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an…
Boian Mitov wrote 26 lines
On Fri, 19 Sep 2014, Adriaan van Os wrote: >>> Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object. It was/is not meant for that. <<< Quite incorrect. All languages with modern RTTI allow for full object inspection, and that includes Delphi 2010 and higher, C#, and even VB has it. The fact is that FPC is just stuck in the last century, and the lack of any even remotely decent RTTI in it makes it unsuitable for any modern development. Our code nowadays relies nearly 100% on advanced RTTI, and it was one of the major factors, we decided to discontinue any attempts to support Lazarus. If the Lazarus goal is to be just what D7 was ~12 or so years ago, fine, but then easier goal is to be just what Turbo Pascal was in the late 80s or even easier goal, just be an assembler. The world has moved since 2000, and FPC seems to be downright stuck technology wise IMHO :-( . With best regards, Boian Mitov

I may be wrong, but if I'm not mistaken, the new Delphi XE RTTI is being implemented in FPC.

My dream is see a project like DORM (
https://delphi-orm.googlecode.com/files/dorm_introduction.pdf) implemented with FPC. :-)

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Boian Mitov
to Jonas Maebe: Why do you take one paragraph out of context and base a whole rant on that which ignores…

Hi Jonas,

I am sorry if I have misinterpreted the meaning of the message. I am just terribly frustrated with the overall state of the FPC :-( . I even offered to donate our enhanced RTTI API to the FPC community with very little interest so far :-( .
I really want FPC/Lazarus to become a real competitor to the rest of the development environments.

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 25 lines
-----Original Message----- From: Jonas Maebe Sent: Friday, September 19, 2014 2:10 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating On 19/09/14 22:49, Boian Mitov wrote: > On Fri, 19 Sep 2014, Adriaan van Os wrote: > >>>> > Your remarks seem to imply that you think RTTI can be used to inspect > any aspect of an object. > It was/is not meant for that. > <<< > > Quite incorrect. All languages with modern RTTI allow for full object > inspection, and that includes Delphi 2010 and higher, C#, and even VB > has it. > The fact is that FPC is just stuck in the last century, Why do you take one paragraph out of context and base a whole rant on that which ignores the other information from the original message? Jonas

Reply by email

Boian Mitov
to silvioprog: I may be wrong, but if I'm not mistaken, the new Delphi XE RTTI is being implemented in…

Hi Silvio,

That was not the case when I checked last time ~3-4 months ago :-( .

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 19 lines
From: silvioprog Sent: Friday, September 19, 2014 2:14 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating On Fri, Sep 19, 2014 at 5:49 PM, Boian Mitov wrote: I may be wrong, but if I'm not mistaken, the new Delphi XE RTTI is being implemented in FPC. My dream is see a project like DORM (https://delphi-orm.googlecode.com/files/dorm_introduction.pdf) implemented with FPC. :-) -- Silvio Clécio My public projects - github.com/silvioprog --------------------------------------------------------------------------------

Reply by email

Ralf Quint
to Boian Mitov: I am sorry if I have misinterpreted the meaning of the message. I am just terribly…
Boian Mitov wrote
Hi Jonas, I am sorry if I have misinterpreted the meaning of the message. I am just terribly frustrated with the overall state of the FPC :-( .

Well, what frustrates me is that there are always people that come up with all kinds of fancy ideas/add-ons/additions that bring absolutely nothing in "real" improvement....

I even offered to donate our enhanced RTTI API to the FPC community with very little interest so far :-( . I really want FPC/Lazarus to become a real competitor to the rest of the development environments.

I really want to become FPC/Lazarus a really stable, reliable development, across multiple platforms, without constantly trying to run along the other "kool kids on the block"...

Ralf

---
This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com

Reply by email

Boian Mitov
to Jonas Maebe: Why do you take one paragraph out of context and base a whole rant on that which ignores…

Hmm.... I read the original message again, and I see it exactly in the same way.
It simply seems to state that the RTTI in FPC is what it is, because at the time when they looked at Delphi ( D7 ? ), it was how the RTTI was done. A lot has changed since then however in Delphi, and FPC seems to have moved very little, so I don't see how I have misinterpreted it.

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 13 lines
-----Original Message----- From: Jonas Maebe Sent: Friday, September 19, 2014 2:10 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating On 19/09/14 22:49, Boian Mitov wrote: Why do you take one paragraph out of context and base a whole rant on that which ignores the other information from the original message? Jonas

Reply by email

Boian Mitov
to Ralf Quint: Well, what frustrates me is that there are always people that come up with all kinds of…

Me too!

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 11 lines
-----Original Message----- From: Ralf Quint Sent: Friday, September 19, 2014 2:50 PM To: Subject: Re: [fpc-devel] RTTI generating On 9/19/2014 2:38 PM, Boian Mitov wrote: I really want to become FPC/Lazarus a really stable, reliable development, across multiple platforms, without constantly trying to run along the other "kool kids on the block"...

Reply by email

Sven Barth
to Boian Mitov: I am sorry if I have misinterpreted the meaning of the message. I am just terribly…
"Boian Mitov" wrote
I even offered to donate our enhanced RTTI API to the FPC community with

very little interest so far :-( .

Your API would be welcome, but it's of no use when we don't yet generate the data your API relies on. And implementing that takes a sufficient amount of free time. Don't forget that we work on FPC on our free time without being paid for it (mostly at least). And then the extended RTTI isn't the only thing that wants to be implemented. Just a short list of those:

- dynamic packages (working on that)
- generic methods and functions (working on that)
- attributes (being worked at) and extended RTTI
- invoke (needs generic methods for TValue)
- anonymous functions (being worked at or not... Don't know the current state)
- Vector Pascal support
- the new array initializers from XE7
- interface delegation to classes
- usable cppclass support

Regards,
Sven

Reply by email

Boian Mitov
to Sven Barth

Hi Sven,

Thank you!
This is all great news. I perfectly understand, and I also support some open source projects. However the dynamic packages have been in the works for at least 5-6 years if I recall. If the product does not catch up on at least some of those items, it simply will become irrelevant :-( . It will be a shame after all the great effort that has already gone into it if.

I am extremely overworked myself, but I am looking into any option to help it.

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 26 lines
From: Sven Barth Sent: Friday, September 19, 2014 3:19 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating Am 19.09.2014 23:39 schrieb "Boian Mitov" : > I even offered to donate our enhanced RTTI API to the FPC community with very little interest so far :-( . Your API would be welcome, but it's of no use when we don't yet generate the data your API relies on. And implementing that takes a sufficient amount of free time. Don't forget that we work on FPC on our free time without being paid for it (mostly at least). And then the extended RTTI isn't the only thing that wants to be implemented. Just a short list of those: - dynamic packages (working on that) - generic methods and functions (working on that) - attributes (being worked at) and extended RTTI - invoke (needs generic methods for TValue) - anonymous functions (being worked at or not... Don't know the current state) - Vector Pascal support - the new array initializers from XE7 - interface delegation to classes - usable cppclass support Regards, Sven --------------------------------------------------------------------------------

Reply by email

Hans-Peter Diettrich
to Boian Mitov: Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an…
Show quoted text 11 lines
On Fri, 19 Sep 2014, Adriaan van Os wrote: >>> Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object. It was/is not meant for that. <<< Quite incorrect. All languages with modern RTTI allow for full object inspection, and that includes Delphi 2010 and higher, C#, and even VB has it.

It's up to the coder to make all properties etc. published, when he *intends* to ever use RTTI on them. That't the way to tell the compiler what to do.

Inside a program there exists no distinct "brave object inspector" and "unauthorized object garbler" - both can be implemented by using RTTI. If you don't like safe types and other restrictions, which exist in Pascal for good reasons, then choose any unsafe language to implement whatever mess you like :-]

DoDi

Reply by email

Boian Mitov
to Hans-Peter Diettrich

Hi Hans,

I am sorry to disagree with you.
The attributes in particular allow you to do real magic, and reduce your code by at least 4 times, and speed up your development up to 10 times. We have done that in Delphi.
I actually did a session in the PasCon few days on that. Here is example:

TMyInterfacedClass1 = class;

[CreateType( typeinfo( TMyInterfacedClass1 ))] // Specifies the default creation type as TMyInterfacedClass1
IMyInterface = interface
['{EB12CEBD-42C3-4259-AE2C-70267B67F454}']

  function GetValue() : String;
end;
TMyInterfacedClass1 = class( TBasicInterfacedObject, IMyInterface )
public
  function GetValue() : String;
end;
TMyInterfacedClass2 = class( TBasicInterfacedObject, IMyInterface )
public
  function GetValue() : String;
end;
TMyNestedClass = class( TBasicObject )
protected
  [Default( True )] // FValue1 will be initialized with True
  FValue1 : Boolean;
  [Default( 11.5 )] // FValue2 will be initialized with 11.5
  FValue2 : Real;

[AutoManage( TMyInterfacedClass2 )] // FInterfaceValue will be created as TMyInterfacedClass2

  FInterfaceValue  : IMyInterface;
public
  property Value1 : Boolean               read FValue1;
  property Value2 : Real                  read FValue2;
  property InterfaceValue : IMyInterface  read FInterfaceValue;
end;
TMyClass = class( TBasicObject )
protected
  [Default( 100 )] // FValue1 will be initialized with 100
  FValue1   : Integer;
  [Default( 'Helo World!' )]
  FValue2   : String; // FValue1 will be initialized with 'Helo World!'
  [AutoManage] // FNested will be automatically created and destroyed
  FNested   : TMyNestedClass;

[AutoManage( TStringList )] // FStrings will be automatically created as TStringList and destroyed

  // [AutoDestroy] // - If AutoDestroy is used instead of AutoManage, the

object will not be created but will be automatically destroyed!

  FStrings  : TStrings;
  [AutoManage] // FNested will be automatically created as TStringArrayList
  FStringArrayList  : IStringArrayList;
  [AutoManage]  // FInterfaceValue will be created as TMyInterfacedClass1
  FInterfaceValue  : IMyInterface;
public
  property Value1 : Integer                   read FValue1;
  property Value2 : String                    read FValue2;
  property Nested : TMyNestedClass            read FNested;
  property Strings : TStrings                 read FStrings;
  property StringArrayList : IStringArrayList read FStringArrayList;
  property InterfaceValue : IMyInterface      read FInterfaceValue;
end;

As you can see all the management of all the classes and interfaces is done without the need of even one line of code.
No constructors, no destructors, nothing.
This alone cuts vast amounts of code.
This however only scratches the surface of the RTTI power. You have no idea about some of the other possibilities ;-) .
The RTTI does not only work with properties and fields, but with functions as well, allowing easy implementation of RPC and network distributed execution.
It is a whole ball game.
Frankly some of the arguments you provide ware the same I have heard 20 years ago when I programmed in C++ and people ware telling me I should be doing it in Assembler.
They simply had no idea what power OOP had as example, as you probably have no idea what is the real power of modern RTTI when properly used.

I am at the same time huge fan of strong typed languages. The advanced RTTI does not really mean the code should and will not be strongly typed. Indeed I have done my own RTTI API which is stronger typed than the one Delphi provides.

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 20 lines
-----Original Message----- From: Hans-Peter Diettrich Sent: Friday, September 19, 2014 4:28 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating Boian Mitov schrieb: It's up to the coder to make all properties etc. published, when he *intends* to ever use RTTI on them. That't the way to tell the compiler what to do. Inside a program there exists no distinct "brave object inspector" and "unauthorized object garbler" - both can be implemented by using RTTI. If you don't like safe types and other restrictions, which exist in Pascal for good reasons, then choose any unsafe language to implement whatever mess you like :-] DoDi

Reply by email

Den
to Ralf Quint: Well, what frustrates me is that there are always people that come up with all kinds of…
Well, what frustrates me is that there are always people that come up with all kinds of fancy ideas/add-ons/additions that bring absolutely nothing in "real" improvement....

Ahem, it seems when people DO bring patches and improvements to the table, they never get accepted, and discourage any more improvements from them in the future.. *Cough* .. *Cough* ... :p

*Refers to INCLUDESTRINGFILE and OpenGL ES/EGL Split I made* .. At least my Apache Patches got applied. :p (Thanks Michael!)

I really want to become FPC/Lazarus a really stable, reliable development, across multiple platforms, without constantly trying to run along the other "kool kids on the block"...

Like I said before, I would be willing to contribute more if my patches were to get included and not just laying there now. I even implemented every suggestion and created tests (for the INCLUDESTRINGFILE one anyway).

- Dennis Fehr

Reply by email

Den
to Sven Barth: very little interest so far :-( . Your API would be welcome, but it's of no use when we…

Hi Sven,

What would you say the status on Generic Methods/Functions if you were to give a status for it?

- Dennis Fehr

P.S. I see you added CPPClass support to the bottom of that list, very much looking forward to that too! .. I know it's kinda a bit difficult as you have to follow the VMT of C++ as it is incompatible with FPC's -- Obviously lol

Sven Barth wrote 32 lines
Am 19.09.2014 23:39 schrieb "Boian Mitov" < >: > I even offered to donate our enhanced RTTI API to the FPC community with very little interest so far :-( . Your API would be welcome, but it's of no use when we don't yet generate the data your API relies on. And implementing that takes a sufficient amount of free time. Don't forget that we work on FPC on our free time without being paid for it (mostly at least). And then the extended RTTI isn't the only thing that wants to be implemented. Just a short list of those: - dynamic packages (working on that) - generic methods and functions (working on that) - attributes (being worked at) and extended RTTI - invoke (needs generic methods for TValue) - anonymous functions (being worked at or not... Don't know the current state) - Vector Pascal support - the new array initializers from XE7 - interface delegation to classes - usable cppclass support Regards, Sven _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

silvioprog
to Boian Mitov: I am sorry to disagree with you. The attributes in particular allow you to do real magic,…
Boian Mitov wrote
Hi Hans, I am sorry to disagree with you.

+1.

The attributes in particular allow you to do real magic, and reduce your code by at least 4 times, and speed up your development up to 10 times.

I tested the new RTTI in Delphi XE and it reduced my typing alot. See:

(* credits: https://code.google.com/p/delphi-orm/ *)
var
  person: TPerson; oid: Integer;
begin
  person := TPerson.Create('Daniele', 'Teti',32);
  Session.Save(person);
  oid := person.id;
  person.Free;
...
  person := Session.Load<TPerson>(oid);
  WriteLn(‘Person name is: ‘, person.FirstName);
  person.Free;
end;

I'm using an approach like this in Android development (with Java: http://ormlite.com/sqlite_java_android_orm.shtml).

We have done that in Delphi.

Show quoted text 78 lines
I actually did a session in the PasCon few days on that. Here is example: TMyInterfacedClass1 = class; [CreateType( typeinfo( TMyInterfacedClass1 ))] // Specifies the default creation type as TMyInterfacedClass1 IMyInterface = interface ['{EB12CEBD-42C3-4259-AE2C-70267B67F454}'] function GetValue() : String; end; TMyInterfacedClass1 = class( TBasicInterfacedObject, IMyInterface ) public function GetValue() : String; end; TMyInterfacedClass2 = class( TBasicInterfacedObject, IMyInterface ) public function GetValue() : String; end; TMyNestedClass = class( TBasicObject ) protected [Default( True )] // FValue1 will be initialized with True FValue1 : Boolean; [Default( 11.5 )] // FValue2 will be initialized with 11.5 FValue2 : Real; [AutoManage( TMyInterfacedClass2 )] // FInterfaceValue will be created as TMyInterfacedClass2 FInterfaceValue : IMyInterface; public property Value1 : Boolean read FValue1; property Value2 : Real read FValue2; property InterfaceValue : IMyInterface read FInterfaceValue; end; TMyClass = class( TBasicObject ) protected [Default( 100 )] // FValue1 will be initialized with 100 FValue1 : Integer; [Default( 'Helo World!' )] FValue2 : String; // FValue1 will be initialized with 'Helo World!' [AutoManage] // FNested will be automatically created and destroyed FNested : TMyNestedClass; [AutoManage( TStringList )] // FStrings will be automatically created as TStringList and destroyed // [AutoDestroy] // - If AutoDestroy is used instead of AutoManage, the object will not be created but will be automatically destroyed! FStrings : TStrings; [AutoManage] // FNested will be automatically created as TStringArrayList FStringArrayList : IStringArrayList; [AutoManage] // FInterfaceValue will be created as TMyInterfacedClass1 FInterfaceValue : IMyInterface; public property Value1 : Integer read FValue1; property Value2 : String read FValue2; property Nested : TMyNestedClass read FNested; property Strings : TStrings read FStrings; property StringArrayList : IStringArrayList read FStringArrayList; property InterfaceValue : IMyInterface read FInterfaceValue; end;

I intend to do the following if the new RTTI (of Delphi XE) come in FPC 2.8.0 (like Java annotations):

TPerson = class(TObject) // or TSerializableObject published
{ @code(Id): Field used to store the ID of each *Person*. } ['integer', 'notnull', 'autoinc', 'primarykey']

  property Id: Int64;
  { @code(Name): Field used to store the name of each *Person*. }
  ['string:50', 'nonull', 'unique']
  property Name: string;

end;

And from this object above, my framework will generate the metadata for the table creation, generation of HTML/JS forms, generation of object mappers, generation of CRUD web actions with their REST paths, generation of documentation and UML, among others.

Show quoted text 20 lines
As you can see all the management of all the classes and interfaces is done without the need of even one line of code. No constructors, no destructors, nothing. This alone cuts vast amounts of code. This however only scratches the surface of the RTTI power. You have no idea about some of the other possibilities ;-) . The RTTI does not only work with properties and fields, but with functions as well, allowing easy implementation of RPC and network distributed execution. It is a whole ball game. Frankly some of the arguments you provide ware the same I have heard 20 years ago when I programmed in C++ and people ware telling me I should be doing it in Assembler. They simply had no idea what power OOP had as example, as you probably have no idea what is the real power of modern RTTI when properly used. I am at the same time huge fan of strong typed languages. The advanced RTTI does not really mean the code should and will not be strongly typed. Indeed I have done my own RTTI API which is stronger typed than the one Delphi provides.

I was very curious to see your RTTI API. :-)

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Boian Mitov
to silvioprog

Hi Silvio,

Please contact me at , and I will send it to you.
It is for XE4 and higher only however since older XE versions have some compiler issues. It is a new API design from the ground up, making everything extremely easy to do, fixing some hierarchy design bugs in the Emb. version, and adding some missing information.

We will release it in few weeks as a free download, working on the documentation and the demos at the moment.

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 17 lines
From: silvioprog Sent: Friday, September 19, 2014 8:41 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating On Fri, Sep 19, 2014 at 9:08 PM, Boian Mitov wrote: I was very curious to see your RTTI API. :-) -- Silvio Clécio My public projects - github.com/silvioprog --------------------------------------------------------------------------------

Reply by email

silvioprog
to Boian Mitov
Boian Mitov wrote 12 lines
Hi Silvio, Please contact me at , and I will send it to you. It is for XE4 and higher only however since older XE versions have some compiler issues. It is a new API design from the ground up, making everything extremely easy to do, fixing some hierarchy design bugs in the Emb. version, and adding some missing information. We will release it in few weeks as a free download, working on the documentation and the demos at the moment.

This is one of the best news I've heard this week!

Show quoted text 8 lines
With best regards, Boian Mitov ------------------------------------------------------- Mitov Software www.mitov.com -------------------------------------------------------

I sent a private e-mail for you.

Thank you very much! (y)

@off: A long time ago, when I worked with electronics (I created PWM amplifiers and distortion pedals for guitars), I used your library: InstrumentalLab. Good times. :-)

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Michael Van Canneyt
to Boian Mitov: Thank you! This is all great news. I perfectly understand, and I also support some open…
Boian Mitov wrote 9 lines
  Hi Sven,   Thank you! This is all great news. I perfectly understand, and I also support some open source projects. However the dynamic packages have been in the works for at least 5-6 years if I recall. If the product does not catch up on at least some of those items, it simply will become irrelevant :-( . It will be a shame after all the great effort that has already gone into it if.   I am extremely overworked myself, but I am looking into any option to help it.

We are all overworked. The bugtracker keeps filling.

None of us likes the accusation that 'FPC is stuck in the last century'.

But as Sven pointed out: there are many other things that also merit work, and we're all just volunteers who do this on our spare time, as we have pointed out many times in the past.

Personally, I can't wait to see Joost's implementation of extended RTTI and attributes merged to the trunk compiler.
Unfortunately, I don't have the knowledge to do it myself...

Michael.

Reply by email

Jonas Maebe
to Boian Mitov: Hmm.... I read the original message again, and I see it exactly in the same way. It…
Boian Mitov wrote 11 lines
------------------------------------------------------- -----Original Message----- From: Jonas Maebe Sent: Friday, September 19, 2014 2:10 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating > Why do you take one paragraph out of context and base a whole rant on > that which ignores the other information from the original message? Hmm.... I read the original message again, and I see it exactly in the same way.

It ended with saying that D2010-style extended RTTI is being worked on. If you are happy with what Delphi supports in terms of RTTI (which I understood you are), then that should be fine. The work that has been done on it so far is available from the
http://svn.freepascal.org/svn/fpc/branches/joost/classattributes/ branch. It hasn't been synchronised with trunk for a long time though.

Jonas

Reply by email

Sven Barth
to Den: What would you say the status on Generic Methods/Functions if you were to give a status…
"Den" wrote
Hi Sven, What would you say the status on Generic Methods/Functions if you

were to give a status for it?

In my local repository I have global functions/procedures working (something that Delphi can not ;) ), but methods not yet. Also I still have some troubles with assigning procedure/method pointers if there are overloads...

P.S. I see you added CPPClass support to the bottom of that list, very

much looking forward to that too! .. I know it's kinda a bit difficult as you have to follow the VMT of C++ as it is incompatible with FPC's -- Obviously lol

I need CPPClass support for our OS at work which is based on C++ and I don't want to write a flattening library for everything... :/

Regards,
Sven

Reply by email

Sven Barth
to Hans-Peter Diettrich: It's up to the coder to make all properties etc. published, when he *intends* to ever use…
"Hans-Peter Diettrich" wrote 7 lines
Boian Mitov schrieb: > On Fri, 19 Sep 2014, Adriaan van Os wrote: > >>>> > Your remarks seem to imply that you think RTTI can be used to inspect

any aspect of an object.

> It was/is not meant for that. > <<< > > Quite incorrect. All languages with modern RTTI allow for full object

inspection, and that includes Delphi 2010 and higher, C#, and even VB has it.

It's up to the coder to make all properties etc. published, when he

*intends* to ever use RTTI on them. That't the way to tell the compiler what to do.

Inside a program there exists no distinct "brave object inspector" and

"unauthorized object garbler" - both can be implemented by using RTTI. If you don't like safe types and other restrictions, which exist in Pascal for good reasons, then choose any unsafe language to implement whatever mess you like :-]

The extended RTTI introduced with Delphi 2010 allows you to even query private fields if the class developer decided to enable data generation for that.

Regards,
Sven

Reply by email

Sven Barth
to Boian Mitov: Thank you! This is all great news. I perfectly understand, and I also support some open…
"Boian Mitov" wrote 5 lines
Hi Sven, Thank you! This is all great news. I perfectly understand, and I also support some

open source projects.

However the dynamic packages have been in the works for at least 5-6

years if I recall.

There wasn't that much work that went into packages till I started to work on it last summer. There was a stub to parse package files and the Win32 has support for indirect entry information (used for starting the program) which is needed for packages, but other than that there wasn't much anyway. I you want to stay updated, then keep an eye on my branch in /branches/svenbarth/packages.

If the product does not catch up on at least some of those items, it

simply will become irrelevant :-( . It will be a shame after all the great effort that has already gone into it if.

I think you overstate the importance of these features versus the user base we already have without them. I agree that they are all nice to have, but I don't believe that we'd become irrelevant if we don't have them. We are too big already I'd say.

Regards,
Sven

Reply by email

Hans-Peter Diettrich
to Sven Barth: any aspect of an object. inspection, and that includes Delphi 2010 and higher, C#, and…
Show quoted text 9 lines
Am 20.09.2014 01:52 schrieb "Hans-Peter Diettrich" < > It's up to the coder to make all properties etc. published, when he *intends* to ever use RTTI on them. That't the way to tell the compiler what to do. The extended RTTI introduced with Delphi 2010 allows you to even query private fields if the class developer decided to enable data generation for that.

AFAIK it works in the opposite direction: the developer must *exclude* explicitly, in *every* unit, what should *not* be subject to extended RTTI. That's my strongest point against (Delphi) extended RTTI, while RTTI by itself is okay for me.

I think that it's time to resume the work on my Delphi decompiler. I never published it before, but now it looks like it's time to wake up the XE coders, like the VB3 coders decades ago.

DoDi

Reply by email

Peter Popov
to silvioprog: I may be wrong, but if I'm not mistaken, the new Delphi XE RTTI is being implemented in…

I will add quick comment to this discussion: our products heavily rely on the "automated" keyword, introduced in Delphi 2. What we use it for is either to link dynamically GUI elements to particular code, or to do a particular form of RPC. That is, the gui does not in advance the structure of the code it is to represent. The key is the RTTI generated for automated methods (although we need a hack to get the auto table start pointer).

Something like this would be extremely useful if we are to fully switch to fpc.

Peter Popov

silvioprog wrote 41 lines
On Fri, Sep 19, 2014 at 5:49 PM, Boian Mitov wrote: > On Fri, 19 Sep 2014, Adriaan van Os wrote: > > >>>> Your remarks seem to imply that you think RTTI can be used to >>>> inspect > any aspect of an object. > It was/is not meant for that. > <<< > > Quite incorrect. All languages with modern RTTI allow for full object > inspection, and that includes Delphi 2010 and higher, C#, and even VB > has > it. > The fact is that FPC is just stuck in the last century, and the lack of > any even remotely decent RTTI in it makes it unsuitable for any modern > development. > Our code nowadays relies nearly 100% on advanced RTTI, and it was one of > the major factors, we decided to discontinue any attempts to support > Lazarus. > > If the Lazarus goal is to be just what D7 was ~12 or so years ago, fine, > but then easier goal is to be just what Turbo Pascal was in the late > 80s or > even easier goal, just be an assembler. > The world has moved since 2000, and FPC seems to be downright stuck > technology wise IMHO :-( . > > With best regards, > Boian Mitov I may be wrong, but if I'm not mistaken, the new Delphi XE RTTI is being implemented in FPC. My dream is see a project like DORM ( https://delphi-orm.googlecode.com/files/dorm_introduction.pdf) implemented with FPC. :-)
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply by email

Peter Popov
to Boian Mitov: I am sorry if I have misinterpreted the meaning of the message. I am just terribly…

I am interested.

Boian Mitov wrote 46 lines
Hi Jonas, I am sorry if I have misinterpreted the meaning of the message. I am just terribly frustrated with the overall state of the FPC :-( . I even offered to donate our enhanced RTTI API to the FPC community with very little interest so far :-( . I really want FPC/Lazarus to become a real competitor to the rest of the development environments. With best regards, Boian Mitov ------------------------------------------------------- Mitov Software www.mitov.com ------------------------------------------------------- -----Original Message----- From: Jonas Maebe Sent: Friday, September 19, 2014 2:10 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating On 19/09/14 22:49, Boian Mitov wrote: > On Fri, 19 Sep 2014, Adriaan van Os wrote: > >>>> > Your remarks seem to imply that you think RTTI can be used to inspect > any aspect of an object. > It was/is not meant for that. > <<< > > Quite incorrect. All languages with modern RTTI allow for full object > inspection, and that includes Delphi 2010 and higher, C#, and even VB > has it. > The fact is that FPC is just stuck in the last century, Why do you take one paragraph out of context and base a whole rant on that which ignores the other information from the original message? Jonas _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Sven Barth
to Hans-Peter Diettrich: AFAIK it works in the opposite direction: the developer must *exclude* explicitly, in…
Hans-Peter Diettrich wrote 15 lines
Sven Barth schrieb: > Am 20.09.2014 01:52 schrieb "Hans-Peter Diettrich" < > > It's up to the coder to make all properties etc. published, when he > *intends* to ever use RTTI on them. That't the way to tell the > compiler what to do. > The extended RTTI introduced with Delphi 2010 allows you to even query > private fields if the class developer decided to enable data > generation for that. AFAIK it works in the opposite direction: the developer must *exclude* explicitly, in *every* unit, what should *not* be subject to extended RTTI. That's my strongest point against (Delphi) extended RTTI, while RTTI by itself is okay for me.

The default values are public and published for methods and properties and all visibilities for fields.

Regards,
Sven

Reply by email

Florian Klämpfl
to Boian Mitov: Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an…
Boian Mitov wrote 11 lines
On Fri, 19 Sep 2014, Adriaan van Os wrote: >>> Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object. It was/is not meant for that. <<< Quite incorrect. All languages with modern RTTI allow for full object inspection, and that includes Delphi 2010 and higher, C#, and even VB has it. The fact is that FPC is just stuck in the last century, and the lack of any even remotely decent RTTI in it makes it unsuitable for any modern development.

FPC supports what it's users are implementing. No more no less. This is how a community driven OSS project works.

Reply by email

Sven Barth
to Florian Klämpfl
"Florian Klämpfl" wrote
Am 20.09.2014 um 08:47 schrieb Michael Van Canneyt: > > Personally, I can't wait to see Joost's implementation of extended RTTI

and attributes merged to the

> trunk compiler. Is it finished? I thought it is still work in progress?

It depends what you define as finished: it currently provides only class attributes, but not attributes for other constructs nor the extended RTTI, but basic structures that are needed for it. That's basically how far Joost wanted to get it.

Regards,
Sven

Reply by email

Boian Mitov
to Sven Barth

If the compiler information is generated, I can work on the API to access it. I think I can easily port my API to do that, and can contribute the version to the open source project.

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 12 lines
From: Sven Barth Sent: Saturday, September 20, 2014 12:32 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating Am 20.09.2014 18:05 schrieb "Florian Klämpfl" : It depends what you define as finished: it currently provides only class attributes, but not attributes for other constructs nor the extended RTTI, but basic structures that are needed for it. That's basically how far Joost wanted to get it. --------------------------------------------------------------------------------

Reply by email

Sven Barth
to Boian Mitov
"Boian Mitov" wrote
If the compiler information is generated, I can work on the API to access

it. I think I can easily port my API to do that, and can contribute the version to the open source project.

Maybe you could document the binary format of the extended RTTI data. That would IMHO currently help more than the API.

Regards,
Sven

Reply by email

Boian Mitov
to Sven Barth

Hi Sven,

Please if you have done the RTTI work, please contact me at , and we can discuss what I can do. Otherwise please put me in touch with whomever is working on it, so we can collaborate.

With best regards,
Boian Mitov

------------------------------------------------------- Mitov Software
www.mitov.com
-------------------------------------------------------

Earlier message 6 lines
From: Sven Barth Sent: Saturday, September 20, 2014 2:05 PM To: FPC developers' list Subject: Re: [fpc-devel] RTTI generating Maybe you could document the binary format of the extended RTTI data. That would IMHO currently help more than the API.

Reply by email

Adriaan van Os
to Florian Klämpfl: FPC supports what it's users are implementing. No more no less. This is how a community…
Florian Klämpfl wrote 14 lines
Am 19.09.2014 um 22:49 schrieb Boian Mitov: > On Fri, 19 Sep 2014, Adriaan van Os wrote: > > Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object. > It was/is not meant for that. > <<< > > Quite incorrect. All languages with modern RTTI allow for full object inspection, and that includes > Delphi 2010 and higher, C#, and even VB has it. > The fact is that FPC is just stuck in the last century, and the lack of any even remotely decent > RTTI in it makes it unsuitable for any modern development. FPC supports what it's users are implementing. No more no less. This is how a community driven OSS project works.

Thanks for the various reactions to my post about RTTI in FPC. I will wait to see what will be available in the future. To give some background, here is an explanation of what I am trying to accomplish.

The Pascal version of MacApp <http://en.wikipedia.org/wiki/MacApp>, which I am maintaining, has an object browser. That browser is disabled in the current source base, but it could be restored. The browser historically works through the MacApp root object which has

       procedure Fields
         ( procedure DoToField
               (     theFieldName      : Str255;
                     theFieldAddr      : Ptr;
                     theFieldType      : SInt16));

The Fields method must be implemented in every object type that adds fields (not properties, MacApp uses MacPas style classes). This scheme works, but adds a lot of code, like this

procedure TEvtHandler.Fields(procedure DoToField(fieldName: Str255; fieldAddr: Ptr; fieldType:
SInt16));
     begin
       DoToField('TEvtHandler', nil, bClass);
       DoToField('fNextHandler', @fNextHandler, bObject);
       DoToField('fIdleFreq', @fIdleFreq, bLongInt);
       DoToField('fLastIdle', @fLastIdle, bLongInt);
       inherited Fields(DoToField);
     end;

etcetera.

So, I started experimenting with the RTTI to have this automated .....

Regards,

Adriaan van Os

Reply by email