[fpc-devel] Objfpc and generics duplicate identifier

Sven Barth pascaldragon at googlemail.com
Sat Mar 23 14:14:18 CET 2013


On 23.03.2013 00:50, Maciej Izak wrote:
> Hi,
>
> I started to implement Generics.Collections in FreePascal
> (successfully!). I wanted to start using objfpc, but I have a problem
> with generics in fpcobj mode. In Delphi mode i don't have any problems
> with my implementation. For example:
>
> type
>    IEnumerable = interface
>    end;
>
>    IEnumerable<T> = interface
>    end;
>
>    IEnumerable<T1, T2> = interface
>    end;
>
> in fpcobj:
>
> type
>    IEnumerable = interface
>    // ? generic IEnumerable<> = interface
>    end;
>
>    generic IEnumerable<T> = interface // Error: Duplicate identifier
> "IEnumerable$1"
>    end;
>
>    generic IEnumerable<T1, T2> = interface // Error: Duplicate
> identifier "IEnumerable$2"
>    end;
>
> I think it is a big problem... Especially for future usage of
> anonymous methods (when/if they are implemented)... Example from
> Delphi:

This is by design to allow backwards compatiblity with older generic 
code. Maybe I'll add a modeswitch somewhen though to allow this in mode 
ObjFPC as well...

Regards,
Sven




More information about the fpc-devel mailing list