[fpc-pascal] Ideas for namespace implementation
JeLlyFish.software at gmx.net
Tue Jul 27 15:28:01 CEST 2010
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. (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.)
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?
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.
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.
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. ;)
GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
More information about the fpc-pascal