I wish we could use TypeInfo(T) in compiler directives inside of generics...
I wish we could use TypeInfo(T) in compiler directives inside of generics...
Like
{$IF TypeInfo(T).Kind = tkInterface}
some interface specific source
{$ELSEIF TypeInfo(T).Kind = tkClass}
some objects specific source
{$ELSE}
everything else
{$IFEND}
That way we could at least achieve some kind of folding without that insane code duplication that comes with the use of generics.
Btw #Spring4D 1.0 will have a switch to enable folding for lists that contain objects or interfaces to achieve something that is similar to what the C# compiler does with generics for reference types.
Like
{$IF TypeInfo(T).Kind = tkInterface}
some interface specific source
{$ELSEIF TypeInfo(T).Kind = tkClass}
some objects specific source
{$ELSE}
everything else
{$IFEND}
That way we could at least achieve some kind of folding without that insane code duplication that comes with the use of generics.
Btw #Spring4D 1.0 will have a switch to enable folding for lists that contain objects or interfaces to achieve something that is similar to what the C# compiler does with generics for reference types.
Comments
Post a Comment