digitalmars.D.bugs - [Issue 7635] New: Inconsistent naming in std.stdio - byLine(), byChunk()
- d-bugmail puremagic.com (35/35) Mar 03 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7635
- d-bugmail puremagic.com (14/14) Mar 03 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7635
- Sandeep Datta (2/17) Mar 03 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7635 Summary: Inconsistent naming in std.stdio - byLine(), byChunk() Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: minor Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: datta.sandeep gmail.com --- Comment #0 from Sandeep Datta <datta.sandeep gmail.com> 2012-03-03 10:18:23 PST --- The nomenclature adopted for some std.stdio methods like byLine and byChunk is inconsistent with preestablished conventions where functions/properties returning a collection of entities is named using the plural form of said entity. Following convention reduces the cognitive load on developers significantly in the long run. In view of the above IMHO byLine() and byChunk(size_t) should be renamed to lines() and chunks(size_t) respectively. Also the struct ByLines should be renamed to something like LineReader (let's avoid the plural form LinesReader here since presumably the LineReader reads one line at a time). Also convention dictates that class names should be nouns. English is not my first language but IMO "by lines" is neither a noun nor a noun phrase (or gerund for that matter). It seems the by*() names facilitate fluent reading of the foreach construct but as the following code snippet shows the fluency is not lost by using the suggested names... //Read: for each line in stdin.lines() do ... foreach(line; stdin.lines(){ ...do something with line... } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 03 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7635 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |WONTFIX Severity|minor |enhancement --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2012-03-03 12:03:43 PST --- Renaming these things breaks existing code. There's got to be a pretty high value to justify such breakage, and I don't think this case is justified. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 03 2012
Well it was worth a try :) Thanks anyway. On Saturday, 3 March 2012 at 20:03:45 UTC, Walter Bright wrote:http://d.puremagic.com/issues/show_bug.cgi?id=7635 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |WONTFIX Severity|minor |enhancement --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2012-03-03 12:03:43 PST --- Renaming these things breaks existing code. There's got to be a pretty high value to justify such breakage, and I don't think this case is justified.
Mar 03 2012