[fpc-devel] is that intended? private type section in classes versus visibility

Marco van de Voort marcov at stack.nl
Sat Jul 24 12:52:17 CEST 2010


In our previous episode, Graeme Geldenhuys said:
>    // create a generic instance
>    lst1 := fgl.TFPGList.Create();
> 
>   // now create a fpGUI list instance
>    lst2 := fpg_list.TfpgList.Create();
> 
> 
> Problem is that if the unit names clashed, there is now way around the
> problem? Or is there?

Yes, renaming. And the problem of this thread is that IMHO all "solutions"
that were proposed are worse than renaming. (since they involve changing all
places where the unit is referenced. And even then there are significant
performance downsides).

Delphi dotted unit names are just a prefixes with a different separator
char. Still, while no super solution, it would make duplication less likely
(avg unitname would go up), and no ugly cryptic prefixes.

Other solutions that really involve two .pas files with the same name need
something to uniquely identify them. E.g. Java does this with the location
in the classpath hierarchy, but I doubt we would go that far.



More information about the fpc-devel mailing list