On Wed, Jan 27, 2016 at 6:22 AM, Michael Van Canneyt <mich...@freepascal.org > wrote: [...]
> 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. > ExtractFilePath/ExtractFileName sounds more related to file operations, so: Core.File: ... TFile = class sealed(TObject) public class function ExtractPath ... ; static; class function ExtractName ... ; static; ... writeln(TFile.ExtractPath(...)); writeln(TFile.ExtractName(...)); or: Core.File: ... function ExtractPath ...; function ExtractName ...; writeln(File.ExtractPath(...)); writeln(File.ExtractName(...)); (btw the example above needs the -NS feature) IMHO, if the <context> already is called "file", you don't need to add the context name again in the function name, so instead of: writeln(Extract<File>Path(...)); writeln(Extract<File>Path(...)); just use: writeln(<File>.ExtractPath(...)); writeln(<File>.ExtractName(...)); So, you can do <context>.code-completation to get all the features to this context. 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). Both approaches compiles, but I agree the it is a preferencial thing. -- Silvio Clécio
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel