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

Dmitry Boyarintsev skalogryz.lists at gmail.com
Wed Oct 30 20:38:08 CET 2013

On Wed, Oct 30, 2013 at 1:35 PM, Marcos Douglas <md at delfire.net> wrote:

> IMO, the problem is:
> You can not use two unit with the same name.
> So, you can point -- using -Fu -- which unit the compiler will compile
> but you can't used both at the same project.

I guess, technically it should be possible to use two different units with
the same name.

I recall there was a discussion a while (few years) ago, about (re)using
Delphi introduced 'in' syntax (afaik, it is not available in pascal).
  unitA in 'unitA.pas'
  ,unitAA in '.\some\other\place\unitA.pas'
Don't remember what was the conclusion of the conversation.
Yet again, this "in" solution is only allowed at either "program" or
"library" units.

But from the compiler's perspective, if there're two units with the same
name, it would need to solve two problems:
1) decide the rules on what units are using what unit of these 2. (That's
why it was proposed to introduce an extension to -Fu or some other switch)
2) decide about the "object name" for each unit. "UnitA" for the first unit
and "UnitA_1" for the second one (taking into consideartion that there's no
UnitA_1.pas file used)
Linker is not using an "hierarchy" of files, so each object file should be
using a unique name.

It should not be a problem for compiler to do that, unless "precompiled"
object files are used.
Since actual object file name collides, then it just won't work, unless
object file itself is modified to produce unique names.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131030/f6ff1e0c/attachment.html>

More information about the fpc-pascal mailing list