Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Jonathan M Davis
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


Re: Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Andrei Alexandrescu

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 Davis


These 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


Re: Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Adam D. Ruppe
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.


Re: Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Andrej Mitrovic
On 6/13/11, Adam D. Ruppe destructiona...@gmail.com wrote:
 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.


And some of them probably don't even post here!

I'm not sure what removing these two functions buys anyone?


Re: Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Jonathan M Davis
On 2011-06-13 07:07, Adam D. Ruppe wrote:
 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.

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 Davis


Re: Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Andrej Mitrovic
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.


Re: Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Jonathan M Davis
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


Re: Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Jonathan M Davis
On 2011-06-13 08:56, Jonathan M Davis wrote:
 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.

In any case, thanks for finding some evidence that capitalize is actually 
being used.

- Jonathan M Davis


Re: Does anyone actually use std.string.capwords or std.string.capitalize?

2011-06-13 Thread Andrej Mitrovic
On 6/13/11, Jonathan M Davis jmdavisp...@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.