[Lazarus] Packages and units with the same name
leledumbo_cool at yahoo.co.id
Sat Oct 14 06:18:07 CEST 2017
> 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.
Sent from: http://free-pascal-lazarus.989080.n3.nabble.com/
More information about the Lazarus