[Issue 8141] Two small improvements for std.string maketrans and translate

2012-12-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8141


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||yebbl...@gmail.com
 Resolution||FIXED


--- Comment #2 from yebblies yebbl...@gmail.com 2012-12-26 23:48:16 EST ---
I'm guessing this was fixed sufficiently by
https://github.com/D-Programming-Language/phobos/commit/94c06fb2469c0d98be842438b749e61571b42fe3

Please reopen if that's not the case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8141] Two small improvements for std.string maketrans and translate

2012-05-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8141


Jonathan M Davis jmdavisp...@gmx.com changed:

   What|Removed |Added

 CC||jmdavisp...@gmx.com


--- Comment #1 from Jonathan M Davis jmdavisp...@gmx.com 2012-05-28 17:17:53 
PDT ---
https://github.com/D-Programming-Language/phobos/pull/609

does this as part of fixing issue# 7515.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8141] New: Two small improvements for std.string maketrans and translate

2012-05-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8141

   Summary: Two small improvements for std.string maketrans and
translate
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-05-24 14:30:14 PDT ---
A small documentation bug report and a little related enhancement request.

This is part of the std.string Phobos module:


/
 * $(RED Scheduled for deprecation in March 2012.)
 *
 * Construct translation table for translate().
 * BUGS: only works with ASCII
 */

string maketrans(in char[] from, in char[] to)
...
}

/**
 * $(RED Scheduled for deprecation in March 2012.
 *   Please use the version of $(D translate) which takes an AA instead.)
 *
 * Translate characters in s[] using table created by maketrans().
 * Delete chars in delchars[].
 * BUGS: only works with ASCII
 */

string translate()(in char[] s, in char[] transtab, in char[] delchars)



My suggestions are:

1) To remove from both ddocs the $(RED Scheduled for deprecation in March
2012.) and replace BUGS: only works with ASCII with something like: NOTE:
only works with ASCII.


2) This is the signature of the ascii version of translate:

string translate()(in char[] s, in char[] transtab, in char[] delchars)

I suggest to add a null default argument for the delchars argument:

string translate()(in char[] s, in char[] transtab, in char[] delchars=null)

This makes translate() more handy, and it's more similar to the Python
str.translate() method this D function is *copied* from:


 from string import maketrans
 t = maketrans(abc, XYZ)
 absent.translate(t, tn)
'XYse'
 absent.translate(t)
'XYsent'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


Re: Improvements to std.string

2011-06-13 Thread Michael Chen
I vote for the changes. They are better name for newbies like me.

On Mon, Jun 13, 2011 at 9:29 AM, Adam D. Ruppe
destructiona...@gmail.com wrote:
 Jonathan M Davis wrote:
 Would it be better to rename toStringz to toCString when fixing it

 I think it should stay just how it is: toStringz, with a lowercase
 z.

 The reason is a stringz is actually a proper name of sorts -
 the z at the end isn't a new word, but part of the first one.
 At least that's the way it was in assembly!


 Also, it ain't broke. I've sometimes gotten tolower wrong due to
 case. I've never made a mistake on toStringz. I'd be surprised if
 anyone has.



Improvements to std.string

2011-06-12 Thread Jonathan M Davis
https://github.com/D-Programming-Language/phobos/pull/101

I made several improvements to std.string, std.uni, and std.ctype - primarily 
with the aim of fixing function names to be properly camelcased and improving 
unicode support - and while the changes are generally fairly simple and 
generally well-organized, there are quite a few of them, and I think that the 
changes could use some extra eyes. Also, there are probably a few changes 
which deserve some discussion.

For instance, a couple of items which already came up

1. Would it be better to rename toStringz to toCString when fixing it so that 
it's properly camelcased (in my changes I just did toStringZ since it was the 
straightforward fix to the naem, but it's not exactly a great name to begin 
with).

2. Should std.ctype be renamed (or at least the updated functions be put into 
another module which will replace it) - e.g. std.ascii?

I don't want want a bikeshedding discussion, but it is a fairly large commit, 
and it could use a looking over by more than just a couple of Phobos devs, and 
some of the changes likely do merit some discussion. So, feel free to look 
over the pull request and make appropriate suggestions.

- Jonathan M Davis


Re: Improvements to std.string

2011-06-12 Thread Adam D. Ruppe
Jonathan M Davis wrote:
 Would it be better to rename toStringz to toCString when fixing it

I think it should stay just how it is: toStringz, with a lowercase
z.

The reason is a stringz is actually a proper name of sorts -
the z at the end isn't a new word, but part of the first one.
At least that's the way it was in assembly!


Also, it ain't broke. I've sometimes gotten tolower wrong due to
case. I've never made a mistake on toStringz. I'd be surprised if
anyone has.