Jump to content
Sign in to follow this  
Mike Torrettinni

Array size increase with generics

Recommended Posts

19 minutes ago, Lars Fosdal said:

I wish there was a way to have the Json engine recognize the T in TObjectList<T> from the RTTI.  That would have saved us a ton of scaffolding code.

The problem is, that RTTI doesn't provide the T in TSomeGenericClass<T> in the first place. This works for arrays because arrays have information about the element type in their RTTI.


Of course there are workarounds to find out T for an TObjectList<T>, but looking at any code doing that: how would you declare some class type derived from TObjectList<T> without providing T?


BTW, the helpers described in my blog posts do save a ton of scaffolding code. I was able to reduce a unit containing all the serialized classes from over 2000 lines downto less than 1200 lines.


If only I were in charge of designing the relevant Delphi classes, you could bet on some significant improvements :classic_cool:

  • Like 2

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this