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

Alexander Klenin klenin at gmail.com
Tue Mar 5 17:17:37 CET 2013


On Tue, Mar 5, 2013 at 11:13 PM, ListMember <listmember at letterboxes.org> wrote:
> 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.

Ugh, that is definitely not the right solution.
Some alternatives:
1) Make sure "is" and "as" work with generic types --
  maybe they already are?
2) Since currently the specialization has to be named anyway,
  write non-generic versions for "inconvenient" types,
  and use inheritance to factor out common code.
3) Implement partial specialization, in C++ style --
  fundamental solution, but perhaps an overkill
  in the light of the above.

--
Alexander S. Klenin



More information about the fpc-devel mailing list