[Lazarus] Packages and units with the same name

Sven Barth pascaldragon at googlemail.com
Fri Oct 13 23:40:40 CEST 2017


On 13.10.2017 21:32, Marcos Douglas B. Santos via Lazarus wrote:
> On Fri, Oct 13, 2017 at 4:16 PM, Mattias Gaertner via Lazarus
> <lazarus at lists.lazarus-ide.org> wrote:
>> On Fri, 13 Oct 2017 15:42:27 -0300
>> "Marcos Douglas B. Santos via Lazarus" <lazarus at lists.lazarus-ide.org>
>> wrote:
>>
>>> [...]
>>> I thought that only units included in package would be visible outside
>>> (other programs/packages) but I realized that doesn't matter if were
>>> included or not, the visibility is defined only by path (-Fu).
>>
>> Correct. Unit names must be unique in a program.
> 
> Right. But when we use 3rd packages, we don't control which names they
> will use to name their units.
> Moreover, I believe each package should work only in a bounded
> context. Its developers should not named their files considering that
> these names could be used in a bigger context. Don't you agree?
> 
> IMHO, would be better if packages may have just some "exported units".
> What do you think?

It doesn't matter. Any symbols in a unit are mangled only locally to the
unit and there *can not* be two or more symbols with the same name in
one program. What you ask for is simply not possible.

Regards,
Sven


More information about the Lazarus mailing list