[fpc-pascal] Ideas for namespace implementation
md at delfire.net
Thu Aug 5 21:56:14 CEST 2010
On Tue, Jul 27, 2010 at 11:27 AM, Marcos Douglas <md at delfire.net> wrote:
> On Tue, Jul 27, 2010 at 11:10 AM, Martin <fpc at mfriebe.de> wrote:
> > [snip]
> >> 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.
> > Yes, Namespaces (those on top of units) will inherit the same conflict
> > problem that units have. That is as long as the inherit the same source...
> > That means, if the namespace for a unit is given to that unit by the writer
> > of that unit, then 2 writers of 2 units will eventually give the same
> > namespace to equally named units....
> > *if*, but what is if not. What is if the namespace is not set by the writer
> > of the unit, but instead of that by the user of the unit.
> > The user will always know if 2 units do conflict => so he can then set a
> > namespaces => and because the user (as in the writer of the final program)
> > knows already all the names, and decides all the namespaces himself => there
> > will be no conflict.
> As I said:
> > 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?
> > that can be done by giving the namespace to an include path -Fu / -FU (if
> > necessary recursive)
> > => only draw back, you have to do it equally for every PC /installation that
> > you use....
> > (unless the UUID thing....)
> > Then again, it is only worth the bother, if someone actually deems it worth
> > his/her time to implement it....
I was thinking... if we could use a nickname, for an unit, just to
reference it on the code?
The unit (same) name problem still happen, I know... then I have to
rename my units with long names (this is worse) but I could codify
with bit names in my code.
the unit mycompany_strutils.pas will be referenced on the code:
mycompany_strutils as stru;
Is this more easy to implement?
More information about the fpc-pascal