On 20/06/2015 10:27, Vladimir Panteleev wrote:
Naming thingsThere are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton Hello, There has been a lot of recent debate regarding the names of some new functions recently added to Phobos. Mostly this concerns the good work of Walter Bright, and new functions which operate on ranges rather than strings. A few times, many people felt that the names could have been chosen better - in some cases, much better. This is not a singular occurrence, but a recurrent one: http://forum.dlang.org/post/[email protected] https://github.com/D-Programming-Language/phobos/pull/2149#issuecomment-42867964 So far, post-merge name changes have been rejected: https://github.com/D-Programming-Language/phobos/pull/3243 https://github.com/D-Programming-Language/phobos/pull/3426 Two examples of controversial name pairs: setExt/setExtension, and toLower/toLowerCase. These functions have the same functionality, but one of them is eager, and the other is lazy. Can you guess which is which?
Can I guess which is which? I wouldn't guess, I would just look at the doc to figure it out!
Think opening up a browser and looking up the function doc online is cumbersome/annoying? You're right, so just use an IDE that shows the DDoc of the function during code completion. Problem trivially solved. (Both DDT and Mono-D support this functionality)
I would like to present a very similar case in another language, JavaScript. The String method has two functions with a similar name and functionality: "substr" and "substring". If you were to search the web, you can find a multitude of confusion over these functions: http://stackoverflow.com/questions/3745515/what-is-the-difference-between-substr-and-substring https://nathanhoad.net/javascript-difference-between-substr-and-substring http://javarevisited.blogspot.com/2013/08/difference-between-substr-vs-substring-in-JavaScript-tutorial-example.html https://rapd.wordpress.com/2007/07/12/javascript-substr-vs-substring/ https://www.youtube.com/watch?v=OAameXW5r10 I think it's safe to say that it's one of JavaScript's many small warts.
Javascript doesn't have a Javadoc/DDoc analogue, does it? So, not applicable.
-- Bruno Medeiros https://twitter.com/brunodomedeiros
