Recent

Author Topic: Functional programming and fpjsonrtti  (Read 688 times)

LeoBruno

  • Jr. Member
  • **
  • Posts: 61
Functional programming and fpjsonrtti
« on: July 23, 2022, 07:15:39 pm »
Hi:

Is it possble to use FPJsonRtti to serialize OBjects written with Functional Programming?

Code: Pascal  [Select][+][-]
  1.  
  2. type
  3.  
  4.         { TClasse }
  5.  
  6.   TClasse = class(TObject)
  7.   private
  8.     FNome: string;
  9.   published
  10.     function Nome(aValue: string): TClasse; overload;
  11.     function Nome: string; overload;
  12.         end;
  13.  
  14. implementation
  15.  
  16. { TClasse }
  17.  
  18. function TClasse.Nome(aValue: string): TClasse;
  19. begin
  20.   result := Self;
  21.   FNome := aValue;
  22. end;
  23.  
  24. function TClasse.Nome: string;
  25. begin
  26.   result := FNome;
  27. end;  
  28.  
  29.  

thank' s in advance!

--

Maybe the question should be:

How to generate rtti information with functional Object?
« Last Edit: July 25, 2022, 11:07:33 pm by LeoBruno »
Lazarus 2.2.2 FPC 3.2.2 Windows (qt5) Anchor Docking

PascalDragon

  • Hero Member
  • *****
  • Posts: 4556
  • Compiler Developer
Re: Functional programming and fpjsonrtti
« Reply #1 on: July 24, 2022, 10:54:32 pm »
How to generate rtti information with functional Object?

This is not possible with the existing RTTI, because it doesn't store the method's signature which is required for correct overload selection. This will only become possible once the extended RTTI is integrated.

Also please use [ code=pascal ][ /code ] tags for source code which increases readability and also avoids the forum software interpreting certain character sequences.

LeoBruno

  • Jr. Member
  • **
  • Posts: 61
Re: Functional programming and fpjsonrtti
« Reply #2 on: August 07, 2022, 03:41:13 pm »
I need to use functional programming in order to properly work with interfaces, because is hard to implement interfaces with Properties.

Where can I find information about the completion status of the "Extended RTTI"?

Thank you in advance!!



How to generate rtti information with functional Object?

This is not possible with the existing RTTI, because it doesn't store the method's signature which is required for correct overload selection. This will only become possible once the extended RTTI is integrated.

Also please use [ code=pascal ][ /code ] tags for source code which increases readability and also avoids the forum software interpreting certain character sequences.
Lazarus 2.2.2 FPC 3.2.2 Windows (qt5) Anchor Docking

PascalDragon

  • Hero Member
  • *****
  • Posts: 4556
  • Compiler Developer
Re: Functional programming and fpjsonrtti
« Reply #3 on: August 08, 2022, 11:37:22 pm »
Where can I find information about the completion status of the "Extended RTTI"?

Keep an eye on this merge request (or any follow up should this one be closed without merge).

 

TinyPortal © 2005-2018