Recent

Author Topic: [Feature] High level Variant Records  (Read 1132 times)

440bx

  • Hero Member
  • *****
  • Posts: 4727
Re: [Feature] High level Variant Records
« Reply #15 on: October 10, 2024, 10:19:25 pm »
Assuming that String = AnsiString it absolutly not allowed, same for any other managed type (ShortString is not a managed type). This is because the compiler/RTL must be able to correctly apply the type's management functions to the field. If it would be inside a variant record the compiler/RTL would not be able to decide which field is set and thus it might call the management functions on an illegal value.
You're right.  I overlooked that.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Warfley

  • Hero Member
  • *****
  • Posts: 1734
Re: [Feature] High level Variant Records
« Reply #16 on: October 11, 2024, 05:25:04 pm »
I fixed a few bugs that I encountered while testing it further, and added an example program to show how the managed variants can be used to represent tree structures without a single new-dispose :)

VisualLab

  • Hero Member
  • *****
  • Posts: 569
Re: [Feature] High level Variant Records
« Reply #17 on: October 11, 2024, 05:55:07 pm »
In my opinion, this solution would be useful.

 

TinyPortal © 2005-2018