[fpc-pascal] Ideas for namespace implementation

Marcos Douglas md at delfire.net
Tue Jul 27 15:56:50 CEST 2010


On Tue, Jul 27, 2010 at 10:28 AM, "Vinzent Höfler"
<JeLlyFish.software at gmx.net> wrote:
> Marcos Douglas <md at delfire.net>:
>
>> > But then, IME (most) name conflicts are a sure sign of inproper names.
>> Take the
>> > example of "constants.pas": What sort of constants shall I expect there?
>> Screen sizes,
>> > color codes, electron mass or the gravitational constant?
>>
>> You right about "constants.pas".
>> Then I would like to give other example: StrUtils.pas
>> What we expect in unit StrUtils or "Strings Utilities". Is very clear.
>> But we can't use this name. That is the problem (no for FPC's units
>> because we all know their names).
>
> So we can't use it because somebody already written it for us? So why do you want to write it again? Just kidding.

:P
You know... StrUtils was just an example  ;-)

> (Well, if it were Ada you /could/ create a child package of StrUtils
> and add your very own subroutines to the original package, but FPC isn't Ada.)

That is very interesting  :)

> Back to your two StrUtils... Now you do what? Invent a "MyStr" namespace to put your own "StrUtils" into it? And if somebody already did that with his very own version of StrUtils? You rename your namespace again?
>

That is the problem we are discussing!  =)

> See my point? Actually, name clashes will occur every now and when. There is *no* way around it unless you start the whole Java-crap with unique domain name prefixes and even that is not 100% bullet-proof.
>

But you saw some ideas in this (and many others) thread?
eg:
uses Utils in RxLib alias RxUtils

...sounds a way to this problem.

> IMO, if there is no further concept of child units (maybe similar to Ada) there is no point in adding namespaces to FPC, it's not worth the trouble. After all, it's still a name and if somebody else already uses it, you still need another to disambiguate.
>

But if you can CHOOSE the name of alias for the units of others
programmers, in MY project, then I can see a possible solution, don't
you?

> Funny story that is somewhat related: I know that in some town where I lived there are two women with the exact same name, born at exactly the same date. Shit happens. Well, one of those at least was put into another namespace after she married. ;)
>

Before married, the namespace were the name of father and mother, not
your name!  =)
Very funny...

Thanks,
MD



More information about the fpc-pascal mailing list