On Fri, April 3, 2015 13:05, Graeme Geldenhuys wrote:
> On 2015-04-03 10:39, Michael Van Canneyt wrote:


Moving the discussion about advantages out of fpc-pascal elsewhere to
avoid bothering others... :/

>> you just change one option -Fu/GUI/LCL to 2: -Fu/GUI -NLCL
>> I don't see much added value in that.
>
> Other possibly (more useful) usage would be reducing the generic unit
> name clashes. eg: How common is the unit name constants.pas? Very
> common. So when using various libraries that all could contain a unit
> named constants.pas, using namespaces means we can easily get around the
> unit name clash issue.
 .
 .
> ps #2:
> Unit namespace clashing is exactly why fpGUI uses the fpg_* unit name
> format. Because my first attempt of FP* and fpg* clashed with units
> included with FPC.

If you already know that you have a bigger project where it is likely to
get into a conflict (which may indeed be the case easily), you can
obviously avoid that conflict either by selecting and using a namespace in
your project, or equally well by using a prefix as you did with fpGUI.
There's nothing in either of the two cases guaranteeing that you can't get
into a conflict anyway (somebody may pick the same prefix as easily as a
namespace - especially if most people wouldn't be interested to use/type
long and thus more specific namespaces).

Once you start using the units created with namespaces, you have the same
issue again - either you use the short names in your uses clause, etc.,
but then you still may get into the same problem with conflicts as before
(as soon as you start using a 3rd party unit which contains a unit with
the same short name), or you always use the full name, but then you're in
exactly the same situation as with prefixes (the same amount of typing,
etc.).

While there are minor differences, the situation doesn't change very much
from my point of view. It might change a bit more if conventions for
avoiding namespace conflicts are defined (and used) - naming your units
uk.co.geldenhuys.fpgui.* should be sufficiently safe at least until your
DNS record registration expires ( ;-) ) but I don't see this happening on
the Delphi side at least (and defining conventions which wouldn't be used
by Delphi users doesn't seem to make too much sense if we expect using
code/units created in Delphi for FPC).

Tomas


_______________________________________________
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other

Reply via email to