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

Marcos Douglas md at delfire.net
Tue Nov 5 12:36:16 CET 2013


On Mon, Nov 4, 2013 at 10:44 PM, Dmitry Boyarintsev
<skalogryz.lists at gmail.com> wrote:
> On Mon, Nov 4, 2013 at 6:07 PM, Marcos Douglas <md at delfire.net> wrote:
>>
>> Sorry, but this is boring.
>> Do you not agree that is much better propose a solution to be possible
>> to use two -- or more -- units that have the same name but works
>> together at the same project?
>
> Thought process is a boring thing in nature - it supposed to exhaust brain.

=)

> I definitely disagree on benefit of that. Since it opens door not bring a
> unit name from a source to command-line.
> You'll have a project of 10 Classes.pas and you'll define their actual name
> in command line:
> fpc -ALIAS/graphics/classes.pas Graphics -ALIAS/audio/classes.pas audio
> -ALIAS/math/classes.pas
>
> On another project the same unit, might get another alias:
> fpc -ALIAS/graphics/classes.pas Graph -ALIAS/audio/classes.pas sounds

But in Java we have the "same" feature. A project can point to
com.company.foo.lib.MyClass but another project can use only
lib.MyClass.
The packages are defined using directories. Is Java a mess too?

IMHO, my proposal is more flexible than Java because we won't have a
"hard code" for path like Java does. Only the compiler will know about
it, not the sources.

> So management of this kind of projects and libraries turns into a funny
> process.

The big difference is that we are talking about our projects, not
3rd-party libraries.
You -- or the company where you works -- will decide what names will
be better than others, etc.

> From that point of view name spaces (as they're declared in sources) becomes
> far more predictable.
>
> But again, back to namespaces, why people couldn't use underscores "_"? The
> same domain pattern:
> "org_douglas_marcos_classes.pas"
> "org_mse_classes.pas"
> With Delphi 2 the 8.3 file name limitation was removed and everybody could
> start growing their domain libraries.

We back again... The name collision continues!
The problem is: We do not know all names used around the world.

> Ok, nevermind. From what I see the biggest issue is linking and I guess RTTI
> (eventually)

I don't think so. Even the names of the units could be changed "on
demand" by the compiler, using the ALIAS defined before. The linker
would remain the same, without changes.

Best regards,
Marcos Douglas



More information about the fpc-pascal mailing list