Bug 4849 – Remove str.string.abbrev()

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-09-10T12:17:00Z
Last change time
2013-03-04T15:33:27Z
Assigned to
andrei
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-09-10T12:17:33Z
It's good to have minimal APIs, because this reduces the time to learn it, and reduces the time to find the right function/method to use in code. So I suggest to remove the str.string.abbrev() function. Its purpose is not common enough in programs, and its name is not nice.
Comment #1 by andrej.mitrovich — 2010-09-10T14:09:34Z
Aww, I was just looking at this function yesterday and it would come in handy for autocompletion in a text editor. I can always copy the code, I guess..
Comment #2 by andrej.mitrovich — 2010-09-10T14:14:06Z
(In reply to comment #1) > Aww, I was just looking at this function yesterday and it would come in handy > for autocompletion in a text editor. I can always copy the code, I guess.. A bigger WTF is the soundex function. How do you determine how a word sounds? And what if it's not an English word, would it sound different (I assume it would sometime)?
Comment #3 by andrej.mitrovich — 2010-09-11T07:58:00Z
I think this might need renaming, but also I would want this to have additional functionality. If some characters are capitalized, you should be able to abbreviate by using only those chars, e.g.: static string[] list = [ "FoodAndDrinks", "FoodAndCocacola" ]; auto abbrevs = std.string.abbrev(list); foreach (key, value; abbrevs) { writefln("%s => %s", key, value); } This should print out, among other things: ... FAD => FoodAndDrinks FooAD => FoodAndDrinks FAC => FoodAndCocacola Then it would be much more usable as an autocomplete feature. But I don't know if this belongs in Phobos.
Comment #4 by bearophile_hugs — 2010-09-11T08:45:49Z
Even if you want to keep it in Phobos, it needs to be renamed and to be moved out of the std.string module. Because it's not a commonly useful string functionality, it muds the string API.
Comment #5 by andrei — 2013-03-04T15:33:27Z
The name isn't awful enough to warrant a rename at this point. I think we're in good shape.