[Lazarus] Packages and units with the same name
Marcos Douglas B. Santos
md at delfire.net
Sat Oct 14 23:30:07 CEST 2017
On Sat, Oct 14, 2017 at 1:18 AM, leledumbo via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
>> Is it not possible *today* or never?
>
> Never, not without changing the way compiler manages units. FPC units are
> organized in folders for easier management at filesystem level, but
> filesystem is not the namespace, there can never be /first/path/to/a.pas and
> /second/path/to/a.pas used in a single program, because only that a
> identifies the unit, not the path to it. This is the same as you can't have
> two files with the same name under the same path. Indeed you can't control
> unit names written by 3rd party and collision might happen, so most package
> developers add prefix in their unit names (e.g. IdGlobals) or use the new
> dotted unit names (e.g. my.globals.types, your.globals.consts).
>
>> So, the main program shouldn't know nothing about "private units" that
>> belongs only for the package. That is encapsulation too.
>
> Pascal unit is THE namespace, while most other languages uses filesystem as
> namespace. Namespace don't have visibility, only its contents have.
I know how it works in a single program, but I thought that using
packages could be different... but not.
Thanks, anyway.
Best regards,
Marcos Douglas
More information about the Lazarus
mailing list