<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 27, 2016 at 6:22 AM, Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>></span> wrote:</div><div class="gmail_quote">[...]<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Assume we introduce namespaces, do things 'Properly' and introduce<br>
Core.FileUtils<br>
Core.StringUtils<br>
(the names are just examples, to make a point)<br>
<br>
Now let's take example existing routines such as<br>
ExtractFilePath<br>
ExtractFileName<br>
Where do we put them ?<br>
<br>
Both units are a candidate. The former because it is about filenames.<br>
The latter because they are purely string operations.<br>
Your namespace doesn't solve this problem.<br></blockquote><div><br></div><div>ExtractFilePath/ExtractFileName sounds more related to file operations, so:</div><div><br></div><div>Core.File:</div><div>...<br></div><div> TFile = class sealed(TObject)</div><div> public</div><div> class function ExtractPath ... ; static;</div><div> class function ExtractName ... ; static;</div><div>...</div><div><br></div><div><div>writeln(TFile.ExtractPath(...));</div><div>writeln(TFile.ExtractName(...));</div></div><div><br></div><div>or:</div><div><br></div><div><div>Core.File:</div><div>...<br></div><div>function ExtractPath ...;<br></div><div>function ExtractName ...;</div></div><div><br></div><div><div>writeln(File.ExtractPath(...));</div><div>writeln(File.ExtractName(...));</div></div><div><br></div><div>(btw the example above needs the -NS feature)</div><div><br></div><div>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:</div><div><br></div><div>writeln(Extract<File>Path(...));<br></div><div>writeln(Extract<File>Path(...));</div><div><br></div><div>just use:</div><div><br></div><div>writeln(<File>.ExtractPath(...));<br></div><div><div>writeln(<File>.ExtractName(...));</div></div><div><br></div><div>So, you can do <context>.code-completation to get all the features to this context.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Once more, the above is purely theoretical discussion; I am not opposing anything, just pointing out that the use of namespaces is<br>
and remains a matter of preference (or even fashion/hype).</blockquote><div><br></div><div>Both approaches compiles, but I agree the it is a preferencial thing.</div><div><br></div></div>-- <br><div><div dir="ltr"><div>Silvio Clécio</div></div></div>
</div></div>