[fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

Michael Van Canneyt michael at freepascal.org
Wed Jan 27 10:22:21 CET 2016



On Wed, 27 Jan 2016, Anthony Walter wrote:

> Micahel,
>
> Do you care to address the issues I raised with the inconsistency of string
> related functions I raised? Specifically the part about string functions in
> SysUtils, StrUtils, LCLProcs, LazUTF8, among other units where string
> related routines are scattered. Also strings aren't the only types where we
> have these scattered around problems.

I definitely care to address this, but they are IMHO not an argument for namespaces.
(I am assuming you want to make a case still, if not you can ignore the rest of the mail :-) )

These issues can perfectly be solved without namespaces: put everything in StrUtils 
(in the case of strings).


The LazUTF8 routines exist for 2 reasons:
- The decision of Lazarus to use UTF8 as a base string at a time when FPC
   didn't support it properly.
- The much slower release cycle of FPC compared to Lazarus.

These reasons are historical and at least the first one can be solved easily today. 
The second cannot be solved.
Neither are a compelling reason to start namespaces IMHO.

I don't think namespaces are the holy grail.

Assume we introduce namespaces, do things 'Properly' and introduce
Core.FileUtils
Core.StringUtils
(the names are just examples, to make a point)

Now let's take example existing routines such as
ExtractFilePath
ExtractFileName
Where do we put them ?

Both units are a candidate. The former because it is about filenames.
The latter because they are purely string operations.
Your namespace doesn't solve this problem.

If I am a newbie, and I am looking for something like ExtractFilePath, 
where do I start looking ? Namespaces do not help me in the slightest.

In short, I program since 30 years without namespaces. I have never ever
come accross a problem where I thought that namespaces would be an added
value.

Once more, the above is purely theoretical discussion; 
I am not opposing anything, just pointing out that the use of namespaces is
and remains a matter of preference (or even fashion/hype).

As for the actual problem of scattered functionality: 
Please do make proposals, I am all for more logically organized units (or even less units).

Michael.



More information about the fpc-devel mailing list