[fpc-pascal] Namespaces Support

Marcos Douglas md at delfire.net
Sun Oct 27 17:07:36 CET 2013


On Sun, Oct 27, 2013 at 11:59 AM, Marco van de Voort <marcov at stack.nl> wrote:
> In our previous episode, Marcos Douglas said:
>> > Namespaces are only for pseudo hierarchical disambiguation of unit names in
>> > Pascal.
>>
>> Very true. I agree with everything.
>> BUT, IMHO, the only problem is if you have two 3rd frameworks that use
>> the same unit name. In that case I can not add 2 units with the same
>> name in my project. So, only in that case, we could use 'namespaces'
>> to 'rename' these units only for use in our projects without change
>> the original source.
>
> In theory yes, in practice no, since that would be incompatible with
> anything below XE2+ (and most commercial component builders still support
> D7).

Yes and how I still use D7 at work I still have this problem.
This problem happen not only for unit names but component names too. I
can not register two components with the same name.
So, because that, programmers around the world use prefix in class
names. If the components were registered using 'unit+class_name' and
when we drop a component on the Form the IDE write the unit name as a
prefix, this problem not will happen.

My more fresh example is:
I have, for years, many units that have the prefix 'M'. So I have
MClasses, MCore, MTasks, MSystem, etc.
Now MSEgui (by Martin Schreiber) introduced a mclasses unit -- your
own implementation of classes unit -- and I can not use both units in
the same project. :(

> As with any feature, there are people that already design it in after the
> first beta, but it will be rare, very rare, in the wild.

Sorry, I didn't understand what you mean. :(

Regards,
Marcos Douglas



More information about the fpc-pascal mailing list