http://d.puremagic.com/issues/show_bug.cgi?id=4166
Summary: Remove/deprecate std.string.chop Product: D Version: future Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2010-05-09 05:33:14 PDT --- Designing good APIs is not easy. A collection of functions like std.string of Phobos must be large enough to allow all kind of handy operations on strings, but if it's too much large it gets harder to remember the functions and their purpose, and to use them the manual can be required, or it takes more time to remember the right function to use. So there is an optimal number of functions. And the string functions must be well distinct from each other both in their purpose and in their name, so there is no risk of ambiguity about what function to use to solve a string problem while you program quickly. This is true in general even for normal variable names, too much similar variable names are a bad programming practice because they can be confused by programmers that will read you code later. In std.string there are two functions that are subtly different both in name and semantics, chomp and chop. I propose to remove the 'chop' function, that is less useful: if the programmer wants to remove the trailing newline (a newline coming from readln()) the right function to use is chomp. This is a common need. If the programmer wants to remove a fixed amount of chars from the end she/he can use a length test plus string slicing (the test is necessary because D slices are unsafe, unlike Python ones). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------