[fpc-devel] Generics in FPC have many problems

Anthony Walter sysrpl at gmail.com
Mon Aug 29 17:28:57 CEST 2011

On Mon, Aug 29, 2011 at 11:19 AM, Sven Barth <pascaldragon at googlemail.com>wrote:

> Hi!
> As Paul and Jonas already told you, I'm currently working on improving the
> compilers generic implementation. As you have noticed it currently doesn't
> support generic methods and constraints at all. Also the generic
> implementation in mode Delphi isn't working correctly as you've noticed.
> Inline specialications (those without using "type foobar = foo<bar>") don't
> work either.
> For this I have found the following tasks:
> * allow declaring and implementing generics with the Delphi syntax while
> keeping the FPC syntax supported (this is an important point regarding
> backwards compatibility); state: working
> * allow the declarations of multiple generics with the same name (e.g.
> foo<t> =... foo <t, s> = ...); state: mostly working
> * allow inline specializations; state: partly working inside
> implementations; inside declarations this needs to be tested
> * allow nested specializations: not started
> * allow nested generics: not started
> * implement generic methods: not started
> * implement constraints: not started
> My plan is to merge the changes from my branch to trunk after the first
> three points are done (the third one at least mostly as inline
> specializations are rather fragile) to reduce the differences between those
> to branches. Then I'll start working on either generic methods or
> constraints (depends on my mood then).
> Please keep in mind that working on the generics feature isn't an easy
> task, so I can't give you an estimate when the one or other improvement will
> be available.
> If you want you can test around with my branch, but please keep in mind
> that it's a work in progress and that compilation of the compiler or the RTL
> might also be broken from time to time (currently the fgl unit doesn't
> compiler for example).
>  And if someone ever does intent to fix generics in FPC, there are a whole
>> slew of errors that they already bring into the compiler. I'll make a list
>> of examples of those errors at a later time, but they inner workings of
>> generics should be redone to remove the specialization requirement before
>> those errors are addressed.
> If you do such an error list then please provide a single program for each
> problem you encounter so that it might be integrated into FPC's test suite
> which will ease fixing the problem.
> Regards,
> Sven

Wow, Sven, thanks for the reply, and most definitely thanks for working on
FPC. Anything I can do to help I'll do. Last week I sent patches to fix
issues with Lazarus CodeTools and the new generic syntax which basically
caused a lot of problems in the IDE.

I'll be on freenode irc in both #fpc and #lararus-ide for the next few weeks
at least. Where do you want me to send some unit tests/test program source?
The issue tracker? One issue for each test that or all in all tests in one

Also be sure to let me know if there is anything I can do for you. I don't
have much experience with OSS collaboration, but am motivated to get things
done and done the right way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20110829/47f754f7/attachment.html>

More information about the fpc-devel mailing list