[fpc-devel] potential bug, generics vs helpers

Sven Barth pascaldragon at googlemail.com
Fri Jan 27 22:26:26 CET 2012

On 27.01.2012 20:34, Kornel Kisielewicz wrote:
> On Fri, Jan 27, 2012 at 6:37 PM, Sven Barth<pascaldragon at googlemail.com>  wrote:
>> Now regarding Kornel's problem: we could(!) change the way the compiler
>> works in non-Delphi modes to what is described in the documentation (by
>> adding the type symbol's name to the generic's name as well), but this will
>> mean that we would have to define how units in Delphi and non-Delphi modes
>> can interact here. After that the corresponding code in the compiler can be
>> implemented to ensure this.
> Okay, after some thoughts about it, changing the implementation to the
> way the documentation is written would also be bad, because sometimes
> we need to access a generic from another generic, eg:
> generic TGMatrix4<T>  = record
> type TVector4 = specialize TGVector4<T>;
> ...
> end;
> Obviously we want that TGMatrix4 to be compatible with any compatible
> TGVector2 defined elsewhere... Same problem would be in the case of
> implementation of some data structures.

Language design is not as easy as one might think ;) There are always 
corner cases lurking around the corner (pun intended) that you didn't 
thought about before.

But don't worry. I sometimes have the problem as well that I don't see 
the problems with my suggestions.


More information about the fpc-devel mailing list