digitalmars.D - Does anyone actually use std.string.capwords or std.string.capitalize?
- Jonathan M Davis (8/8) Jun 13 2011 I have a hard time believing that std.string.capwords or
- Andrei Alexandrescu (8/16) Jun 13 2011 These are not very D-like, and indeed so: they're part of Walter's
- Adam D. Ruppe (7/10) Jun 13 2011 I use capitalize from time to time. It seems to work well enough.
- Andrej Mitrovic (3/13) Jun 13 2011 And some of them probably don't even post here!
- Jonathan M Davis (9/23) Jun 13 2011 Which is why I'm asking rather than just yanking them. Just because _I_ ...
- bearophile (5/8) Jun 13 2011 What functions?
- Jonathan M Davis (8/16) Jun 13 2011 At the moment, I'm just asking about capitalize and capwords. The useful...
- Jacob Carlborg (5/13) Jun 17 2011 For example, it's used quite a lot in Ruby on Rails, converting names
- Jonathan M Davis (4/19) Jun 17 2011 It's looking like the verdict on this is that capitalize is definitely u...
- Andrej Mitrovic (12/12) Jun 13 2011 It looks like people have reimplemented capitalize in some libs:
- Jonathan M Davis (7/22) Jun 13 2011 Well, capwords is not something you're likely to find implementations of...
- Jonathan M Davis (4/28) Jun 13 2011 In any case, thanks for finding some evidence that capitalize is actuall...
- Andrej Mitrovic (3/8) Jun 13 2011 Agreed. You can already use a mix of split() and capitalize(), so
I have a hard time believing that std.string.capwords or std.string.captitalize are actually used much. It just doesn't seem to me like they would be generally useful functions. They're far too specific in what they do and aren't flexible enough. And if they're not pulling their own weight, then they should be removed from std.string. So, the question is: Is there anyone on the newsgroup here who actually uses std.string.capwords or std.string.capitalize? And if you do, do you use them often? - Jonathan M Davis
Jun 13 2011
On 6/13/11 4:23 AM, Jonathan M Davis wrote:I have a hard time believing that std.string.capwords or std.string.captitalize are actually used much. It just doesn't seem to me like they would be generally useful functions. They're far too specific in what they do and aren't flexible enough. And if they're not pulling their own weight, then they should be removed from std.string. So, the question is: Is there anyone on the newsgroup here who actually uses std.string.capwords or std.string.capitalize? And if you do, do you use them often? - Jonathan M DavisThese are not very D-like, and indeed so: they're part of Walter's experiment to include string functions from other string-savvy languages into Phobos1. These two particular functions are Python's: http://my.safaribooksonline.com/book/programming/python/0201616165/working-with-strings/ch10lev1sec2 It doesn't seem like the experiment was a success. To answer your question, I wouldn't shed a tear if these functions were gone. Andrei
Jun 13 2011
Jonathan M Davis wrote:Is there anyone on the newsgroup here who actually uses std.string.capwords or std.string.capitalize? And if you do, do you use them often?I use capitalize from time to time. It seems to work well enough. Is there really a need to break people's code every other day just because a random function doesn't do everything perfectly? Fixing bugs is one thing, but removing functionality is another. At some point, Phobos devs need to realize that people actually *use* D.
Jun 13 2011
On 6/13/11, Adam D. Ruppe <destructionator gmail.com> wrote:Jonathan M Davis wrote:And some of them probably don't even post here! I'm not sure what removing these two functions buys anyone?Is there anyone on the newsgroup here who actually uses std.string.capwords or std.string.capitalize? And if you do, do you use them often?I use capitalize from time to time. It seems to work well enough. Is there really a need to break people's code every other day just because a random function doesn't do everything perfectly? Fixing bugs is one thing, but removing functionality is another. At some point, Phobos devs need to realize that people actually *use* D.
Jun 13 2011
On 2011-06-13 07:07, Adam D. Ruppe wrote:Jonathan M Davis wrote:Which is why I'm asking rather than just yanking them. Just because _I_ don't find them useful doesn't mean that others don't. If people actually use them, then there's reason to keep them. But there are a number of functions in std.string which at least _look_ like their of limited usefulness, and if they're really not used, then they shouldn't be there. However, if they really _are_ used, then getting rid of them would be a bad idea. So, I'm asking whether anyone uses them. - Jonathan M DavisIs there anyone on the newsgroup here who actually uses std.string.capwords or std.string.capitalize? And if you do, do you use them often?I use capitalize from time to time. It seems to work well enough. Is there really a need to break people's code every other day just because a random function doesn't do everything perfectly? Fixing bugs is one thing, but removing functionality is another. At some point, Phobos devs need to realize that people actually *use* D.
Jun 13 2011
Jonathan M Davis:But there are a number of functions in std.string which at least _look_ like their of limited usefulness, and if they're really not used, then they shouldn't be there.What functions? (I think in Python I have used capitalize only once so far.) Bye, bearophile
Jun 13 2011
On 2011-06-13 09:55, bearophile wrote:Jonathan M Davis:At the moment, I'm just asking about capitalize and capwords. The usefulness (or lack thereof) of various std.string functions has been discussed before, and I think that that it's clear that some of the less basic ones may need to either be removed or revamped, but they need to be looked at individually. But at the moment, capitalize and capwords are the only functions which I'm concerned with. - Jonathan M DavisBut there are a number of functions in std.string which at least _look_ like their of limited usefulness, and if they're really not used, then they shouldn't be there.What functions? (I think in Python I have used capitalize only once so far.)
Jun 13 2011
On 2011-06-13 18:55, bearophile wrote:Jonathan M Davis:For example, it's used quite a lot in Ruby on Rails, converting names between upper and lowercase, between class and table names and so on. -- /Jacob CarlborgBut there are a number of functions in std.string which at least _look_ like their of limited usefulness, and if they're really not used, then they shouldn't be there.What functions? (I think in Python I have used capitalize only once so far.) Bye, bearophile
Jun 17 2011
On 2011-06-17 09:13, Jacob Carlborg wrote:On 2011-06-13 18:55, bearophile wrote:It's looking like the verdict on this is that capitalize is definitely used and should be kept around but that capwords isn't worth keeping. - Jonathan M DavisJonathan M Davis:For example, it's used quite a lot in Ruby on Rails, converting names between upper and lowercase, between class and table names and so on.But there are a number of functions in std.string which at least _look_ like their of limited usefulness, and if they're really not used, then they shouldn't be there.What functions? (I think in Python I have used capitalize only once so far.) Bye, bearophile
Jun 17 2011
It looks like people have reimplemented capitalize in some libs: D:\dev\lib\D\boxen\src\xf\utils\CT.d:25:pragma(ctfe) char[] capitalize(char[] name) { D:\dev\lib\D\boxen\src\xf\xpose2\MiniD.d:51:pragma(ctfe) private char[] capitalizeFirst(char[] str) { D:\dev\lib\D\boxen\src\xf\xpose2\MiniD.d:62: return "set" ~ capitalizeFirst(name); D:\dev\lib\D\boxen\src\xf\xpose2\Utils.d:25:pragma(ctfe) char[] capitalize(char[] name) { And I found a match here: D:\dev\lib\D\enticesource\plugins.d:2317: s = std.string.capitalize(s); I've found no match for capwords though.
Jun 13 2011
On 2011-06-13 08:50, Andrej Mitrovic wrote:It looks like people have reimplemented capitalize in some libs: D:\dev\lib\D\boxen\src\xf\utils\CT.d:25:pragma(ctfe) char[] capitalize(char[] name) { D:\dev\lib\D\boxen\src\xf\xpose2\MiniD.d:51:pragma(ctfe) private char[] capitalizeFirst(char[] str) { D:\dev\lib\D\boxen\src\xf\xpose2\MiniD.d:62: return "set" ~ capitalizeFirst(name); D:\dev\lib\D\boxen\src\xf\xpose2\Utils.d:25:pragma(ctfe) char[] capitalize(char[] name) { And I found a match here: D:\dev\lib\D\enticesource\plugins.d:2317: s =std.string.capitalize(s);I've found no match for capwords though.Well, capwords is not something you're likely to find implementations of by grepping, since the name has a good chance of being different. But regardless, I find it much easier to believe that someone is using capitalize than capwords, particularly since capitalize is a building block of capwords. - Jonathan M Davis
Jun 13 2011
On 2011-06-13 08:56, Jonathan M Davis wrote:On 2011-06-13 08:50, Andrej Mitrovic wrote:In any case, thanks for finding some evidence that capitalize is actually being used. - Jonathan M DavisIt looks like people have reimplemented capitalize in some libs: D:\dev\lib\D\boxen\src\xf\utils\CT.d:25:pragma(ctfe) char[] capitalize(char[] name) { D:\dev\lib\D\boxen\src\xf\xpose2\MiniD.d:51:pragma(ctfe) private char[] capitalizeFirst(char[] str) { D:\dev\lib\D\boxen\src\xf\xpose2\MiniD.d:62: return "set" ~ capitalizeFirst(name); D:\dev\lib\D\boxen\src\xf\xpose2\Utils.d:25:pragma(ctfe) char[] capitalize(char[] name) { And I found a match here: D:\dev\lib\D\enticesource\plugins.d:2317: s =std.string.capitalize(s);I've found no match for capwords though.Well, capwords is not something you're likely to find implementations of by grepping, since the name has a good chance of being different. But regardless, I find it much easier to believe that someone is using capitalize than capwords, particularly since capitalize is a building block of capwords.
Jun 13 2011
On 6/13/11, Jonathan M Davis <jmdavisProg gmx.com> wrote:Well, capwords is not something you're likely to find implementations of by grepping, since the name has a good chance of being different. But regardless, I find it much easier to believe that someone is using capitalize than capwords, particularly since capitalize is a building block of capwords.Agreed. You can already use a mix of split() and capitalize(), so capwords might be a good candidate to remove.
Jun 13 2011