[fpc-pascal] Ideas for namespace implementation

Zaher Dirkey parmaja at gmail.com
Mon Jul 26 22:20:35 CEST 2010


On Mon, Jul 26, 2010 at 8:26 PM, Thierry Coq <tcoq at free.fr> wrote:

> Like Michael,
>
> I see units as namespaces already existing: we use the unit names to prefix
> ambiguous function or variable names for example.
>
> In addition, units are similar (but simpler) to Ada packages, which are
> much more robust than namespaces. If we want to go the full way, let's
> implement Ada packages instead of namespaces, by extending the unit concept.
> (see here for an example : http://www.adaic.org/whyada/intro4.html)
>
> Let's not add yet another concept to manage the naming. Units and types are
> enough. One issue is for example, what would happen to the interface and
> implementation of units, if an additional namespace is introduced? How would
> the conflicts be managed? Would there be private units or public units?
>
> I vote for robust Ada packages, if we need them. Such packages can form a
> hierarchy, can be visible or not from other packages. In addition, we would
> have the ability to separately compile the interface and the implementation
> sections of the unit, which is not possible currently with FPC.
>
> Thierry
>
> I think  namespace = package

rtl package generate rtl.dll or rtl.so (not yet in fpc)

i can use
uses
  rtl.sysutils, mypackage.classes;

or

uses
  sysutils in rtl, classes in mypackage;

we can declare the package/namespcase as like in delphi

package mypackage;
uses
   myunit;
end.

Thanks for the your patient.

-- 
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100726/4357a039/attachment.html>


More information about the fpc-pascal mailing list