[fpc-pascal] Namespaces Support

Marcos Douglas md at delfire.net
Sun Oct 27 14:57:17 CET 2013


On Sun, Oct 27, 2013 at 11:13 AM, Marco van de Voort <marcov at stack.nl> wrote:
> In our previous episode, Fabr?cio Srdic said:
>> > used in Java and .NET as either languages don't have "units".
>> > Adding "features" just because "enterpise-class dev platforms" have them
>> > is more marketing move, than actual technical need.
>> >
>>
>> We can't nest units to form a hierarchical content. With namespaces, we
>> can.
>
> Yes. But that doesn't need renaming all existing units. It is that part that
> I think that is excessive.
>
> Embarcadero did it probably to keep their hands free for some long term VCL
> phase-out (IOW that they wouldn't have to rename FM to avoid VCL names).
>
> We don't have any major such problems, and thus renaming everything is a bit
> draconical to me. At least till we really have a reason to do so.
>
>> Furthermore, namespaces can be used to disambiguate identifiers with
>> the same name, eliminating the need to prefix our identifiers.
>
> That is the main reason why it is added to so many languages;
>
> BUT, Unit based Pascal never had that problem, since units already have
> their own namespace.
>
> 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.

Best regards,
Marcos Douglas



More information about the fpc-pascal mailing list