[fpc-devel] Pass compiler options to generics [was Delphi anonymous methods]

ListMember listmember at letterboxes.org
Tue Mar 5 13:13:06 CET 2013


On 2013-03-05 12:37, Sven Barth wrote:
> Thanks, I try my best :)

I know you do.

And, since generics has also been mentioned in this thread, here is 
something I'd like to table/mention (or, rather, use you as a sounding 
board, if I may).

Sometimes writing generic routines that are truly generic is hard since 
the types it needs to handle can be tough to genericise (strings, 
ordinals, objects etc. are not always treatable in generic routines in 
the same way).

The solution to this might be to write different generic routines for 
each offending type but this means duplication plenty of code in the 
process which in turn defeates quite a bit of the purpose of having 
generics.

This brings me to wonder if it would be possible to pass some constant 
(or set of constants, or something similar) to generic routine such that 
this/these option(s) would be treated as compiles options within the 
implementation of the generic routine.



More information about the fpc-devel mailing list