[fpc-devel] is that intended? private type section in classes versus visibility
Marco van de Voort
marcov at stack.nl
Sun Jul 25 16:20:21 CEST 2010
In our previous episode, Graeme Geldenhuys said:
> Renaming existing units for one project that conflicts is not a
> solution/option either.
Better than using unreadable prefixes or very long unit names.
> On 24 July 2010 12:52, Marco van de Voort <marcov at stack.nl> wrote:
> > 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.
> Does FPC support dotted unit names? eg
No, and FPC's will remain the same anyway.
> then fpGUI and LCL (and any other projects) could do similar.... eg:
Nothing stopping you from using fpgui_button.pas now either.
> Currently fpGUI already does something similar (as I stated before) by
> prefixing all classes with 'Tfpg' and all units names are prefixed
> with 'fpg_' eg:
> I did this to minimize any possible conflicts, but other projects have
> not done this, so they stand a much greater chance to get conflicts
> with FPC or other projects.
I think that chance is overestimated, unless you use very familiar
identifiers (like "buttons").
Typenames are less of a problem, since unit qualification can work around
> I guess Object Pascal users will feel this is "weird" at first - I did
> too with my change in fpGUI, but you soon get used to it.
You can get used to live with only one leg yet. But I don't plan to start
sawing because of that. Getting used to it is not a reason.
> The benefits outweigh with temporary "weird" factor. I would probably
> have preferred a "dotted" unit naming format, but I think last time I
> tried, FPC didn't support a dotted unit name.
I think the problem is blown up out of proportion, and the remedies
draconical. But if you disagree, just use long unit names.
> > 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.
> Why not something like IInterface or IUnknown does by using a GUID
> somewhere in the unit.
Because if I think if a 3 letter prefix is draconical and unreadable, guess
what my opinion about the userfriendlyness of GUID's is. GUIDs are for
meant internal details, not for anything routinely handled by people.
> But then comes the problem that not all editors can generate a GUID
> via a keyboard shortcut - but then, how to they program with
> Interfaces (so maybe a GUID is not a issue).
And moreover, not all editors generate unique UIDs either.
More information about the fpc-devel