In std.algorithm, wouldn't it be clearer if "splitter" was called "splitLazily" or "splitLazy"? "splitter" is a noun, but as a function shouldn't it be a verb. "makeSplitter" or "toSplitter" perhaps?

And what about the "array" function? Wouldn't it be clearer if it was "toArray" so we know we're preforming a convertion?

As you know, I tried to write some guidelines[1] for naming things in D. Those guidelines looks well at first glance, but then you look at Phobos and you see that half of it use some arbitrary naming rules. Take "writefln" for instance: following my guidelines (as they are currently written) it should be renamed to something like "writeFormattedLine".

[1]: http://prowiki.org/wiki4d/wiki.cgi?DProgrammingGuidelines>

I don't necessarily want to change every function name, but if we want this document to make sense and Phobos to have some uniformity, both should be harmonized. Phobos should give the example and follow the guidelines and the guidelines should match Phobos, otherwise the guidelines have no weight for developers of other libraries and Phobos will make life harder to those who want to follow them.

For names we don't want to follow the guidelines, there should be some documentation explaining what rule they disobey and why.

I could take a look at std.algorithm and other modules in Phobos to list inconsistencies with the guidelines. From this we could make improvements both to the guideline document and the API. But before going too deep I think we should start with a few examples, such as those above, and see what to do with them.

What does everyone thinks about all this?


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to