Re: [fpc-pascal] generic way of writing Sets or Enum values to a String

2016-09-06 Thread Graeme Geldenhuys
On 2016-09-06 18:07, leledumbo wrote: > Take mine: Fantastic, I'll give it a go tomorrow. Many thanks. I guess there is a use for Generics then. ;-) Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.

Re: [fpc-pascal] generic way of writing Sets or Enum values to a String

2016-09-06 Thread Jonas Maebe
Graeme Geldenhuys wrote: > Is there a way to have a single implementation of Enum-to-String system.str() also works for enums in FPC. For sets, you can use a for-in loop that calls str(). If you want to encapsulate it in a function, you'll have to use a generic function probably. Jonas _

Re: [fpc-pascal] generic way of writing Sets or Enum values to a String

2016-09-06 Thread leledumbo
> Is there a way to have a single implementation of Enum-to-String or > Set-to-String (and the reverse), but pass in the type, instead of having > a separate implementation of each Enum or Set types. > > Could RTTI help? Could Generics help? Is there some other language > construct I might hav