[fpc-pascal] Re: [Bulk] Re: Namespaces Support

Marcos Douglas md at delfire.net
Tue Oct 29 16:22:47 CET 2013

On Tue, Oct 29, 2013 at 4:10 AM, Graeme Geldenhuys
<graeme at geldenhuys.co.uk> wrote:
> On Tuesday 29/10/2013 at 03:50, Dmitry Boyarintsev  wrote:
>> Then the John Douglas and Douglas McKey are running into the same issue.
>> Both guys (while living on different parts of the world) created the same
>> "douglas" namespace!
> OK, ok, my example was bad. I would apply the exact same namespace rules as
> recommended by Java. In a real situation you should use your domain name for
> the namespace.


> But I get what you say... conflicts could still occur. And so too in Java,
> but the usage of the "company domain name as namespace" greatly reduces the
> chances of a conflict.

I agree.

>> Is it much different than just extending the prefix "M" to "MFP"?
> I must admit, Martin (from MSEgui project) was silly to simply use the "M"
> prefix. It is too easy to have conflicts. That is why I choose "fpg_" as the
> unit prefix and "Tfpg" as the class prefix for the fpGUI Toolkit project.
> The chances of conflicts are much less, but obviously still possible.

FPC uses "fpg" prefix too. You did not have to go so far...  ;-)

>> P.S. Offtopic: I personally find it horrible to call a unit "classes"
>> (it's fine for RTL, since it's started this way, but any other library - it
>> is horrible). Nobody calls their units like "functions" or
>> "functionsandprodures"
> Sure, but much more common unit name issues is Constants.pas or Utils.pas.
> They are ideal names, but are too common, and often cause conflicts with
> other projects or component packages.

Another type of conflict happens -- but no one talks about it -- using
procedure/function with the same parameters in different units.
Eg: GetHandler();  If you use two units that have a GetHandler
function, in a third unit, you have a trouble.
Do you (all) use prefix in Procedures and/or Functions too?  ;-)

Marcos Douglas

More information about the fpc-pascal mailing list