[fpc-pascal] Namespaces Support

Dmitry Boyarintsev skalogryz.lists at gmail.com
Sun Oct 27 05:10:40 CET 2013


On Sat, Oct 26, 2013 at 11:37 PM, Fabrício Srdic
<fabricio.srdic at gmail.com>wrote:
.

>
> We can't nest units to form a hierarchical content. With namespaces, we
> can. Furthermore, namespaces can be used to disambiguate identifiers with
> the same name, eliminating the need to prefix our identifiers. It's a pure
> techinical argument. This is not about "just because enterprise-class
> platforms have them".
>
I believe only global scope identifiers needs to be prefixed? Yet again,
it's not problem for pascal from the start as specifying a unit name
resolves the problem in the first place:

uses unitA, unitB;

t:=unitA.calcFunc(param1) + unitB.calcFunc(param2);

any locally scoped-identifiers (i.e. object/class/record fields, class
methods) doesn't need prefixes.



> Yes, i had no problems while working with D2009 and my units weren't
> unclear. But with the use of the namespace feature, organizing my code got
> much better and new possibilities were added.
>
So, if you've the code reorganized to D2010, is there a sample, from your
personal experience, where re-namespacing actually helped (by saving time
and/or somebody's efforts)?


> They couldn't use Delphi 6 forever, as the Windows and the hardware
> changes more and more. What will happen when they have to change?
>

Very true! They can't, especially if they want a new target platform.
This is there FPC comes into play with its carefully guarded backward
compatibility. (who knows may be {$mode goodolddelphi} will show up}!
So at the time, when they'll have to get away from D-Old, they'll have 2
options - rewrite a lot of code and jump to D-New or rewrite none of the
code and jump to FPC.
Either jumps would require the same amount of testing efforts anyway.

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131027/5579d28a/attachment.html>


More information about the fpc-pascal mailing list