[fpc-pascal] Re: [Bulk] Re: Namespaces Support

Dmitry Boyarintsev skalogryz.lists at gmail.com
Sun Nov 3 03:06:14 CET 2013


On Sat, Nov 2, 2013 at 12:19 PM, Marcos Douglas <md at delfire.net> wrote:

> On Sat, Nov 2, 2013 at 12:32 PM, Dmitry Boyarintsev
> <skalogryz.lists at gmail.com> wrote:
> >
> > On Sat, Nov 2, 2013 at 6:55 AM, Marcos Douglas <md at delfire.net> wrote:
>
This works only if you don't want use StrUtils of your project and,
> IMHO, this is more complex solution. You will need to tell the
> compiler which unit of your project that compiles using an unit in
> another place that uses the same unit name you already uses in your
> project.
>
Not each unit. The search priority can be adjusted for a directory (3d
party library)


> The "rules" that I proposed are:
> 1- Sources in the same directory and/or own tree are compiled using
> the "real names" of units.
> 2- Sources in another tree are (optional) compiled using an "alias".
> These alias are used as a prefix to real names of units.
>
I guess, you need to define "in the same" directory. Is it "the same" to a
project or to a unit?
If to "a unit" then it breaks the compiler backward compatibility.
So, how  to handle the following case?

/program/unit1.pas (uses TheLib.StrUtils)
/program/unit2.pas (uses StrUtils from program)
/program/StrUtils.pas
/lib/StrUtils.pas
/otherlib/otherlibunit.pas (depends on "lib" StrUtils)

So how would you "otherlibunit" to be using TheLib.StrUtils? From what I
can understand (following rule #2), you need to modify "otherlibunit.pas"
and change "uses StrUtils" to "uses TheLib.StrUtils"

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131102/04b37dfa/attachment.html>


More information about the fpc-pascal mailing list