Re: About std.ascii.toLower

2012-09-27 Thread Don Clugston
On 20/09/12 18:57, Jonathan M Davis wrote: On Thursday, September 20, 2012 18:35:21 bearophile wrote: monarch_dodra: It's not, it only *operates* on ASCII, but non ascii is still a legal arg: Then maybe std.ascii.toLower needs a pre-condition that constraints it to just ASCII inputs, so it'

Re: About std.ascii.toLower

2012-09-21 Thread Jonathan M Davis
On Friday, September 21, 2012 14:10:25 monarch_dodra wrote: > I did not know conv's to did cast validation. For conversions which can be done with both casting and std.conv.to, std.conv.to does runtime checks wherever a narrowing conversion would take place and throws if the conversion would los

Re: About std.ascii.toLower

2012-09-21 Thread monarch_dodra
On Friday, 21 September 2012 at 11:25:54 UTC, Jonathan M Davis wrote: On Friday, September 21, 2012 13:18:01 monarch_dodra wrote: Related, could "toChar" be considered for inclusion? I think it would be a convenient tool for validation. I certainly would be against adding it. I think that it's

Re: About std.ascii.toLower

2012-09-21 Thread Jonathan M Davis
On Friday, September 21, 2012 13:18:01 monarch_dodra wrote: > Related, could "toChar" be considered for inclusion? I think it > would be a convenient tool for validation. I certainly would be against adding it. I think that it's a relatively uncommon use case and considering how easy it is to jus

Re: About std.ascii.toLower

2012-09-21 Thread monarch_dodra
On Friday, 21 September 2012 at 10:45:42 UTC, Jonathan M Davis wrote: On Friday, September 21, 2012 12:38:07 monarch_dodra wrote: On Friday, 21 September 2012 at 10:23:39 UTC, Jonathan M Davis wrote: > On Friday, September 21, 2012 11:00:31 monarch_dodra wrote: >> What do you (you two) think of

Re: About std.ascii.toLower

2012-09-21 Thread Jonathan M Davis
On Friday, September 21, 2012 12:38:07 monarch_dodra wrote: > On Friday, 21 September 2012 at 10:23:39 UTC, Jonathan M Davis > > wrote: > > On Friday, September 21, 2012 11:00:31 monarch_dodra wrote: > >> What do you (you two) think of my proposition for a > >> "std.strictascii" module? > > > > I

Re: About std.ascii.toLower

2012-09-21 Thread monarch_dodra
On Friday, 21 September 2012 at 10:23:39 UTC, Jonathan M Davis wrote: On Friday, September 21, 2012 11:00:31 monarch_dodra wrote: What do you (you two) think of my proposition for a "std.strictascii" module? I don't think that it's at all worth it. It's just duplicate functionality in order

Re: About std.ascii.toLower

2012-09-21 Thread Jonathan M Davis
On Friday, September 21, 2012 11:00:31 monarch_dodra wrote: > What do you (you two) think of my proposition for a > "std.strictascii" module? I don't think that it's at all worth it. It's just duplicate functionality in order to avoid a cast. - Jonathan M Davis

Re: About std.ascii.toLower

2012-09-21 Thread monarch_dodra
On Thursday, 20 September 2012 at 17:32:52 UTC, bearophile wrote: Jonathan M Davis: Functions which operate on ASCII characters. All of the functions in std.ascii accept unicode characters but effectively ignore them. All isX functions return false for unicode characters, and all toX functions

Re: About std.ascii.toLower

2012-09-20 Thread bearophile
Jonathan M Davis: Goodness no. :-) 1. Operating on a char is almost always the wrong thing to do. A single char is often not so useful but I have to keep many mutable chars, keeping them as char[] instead of dchar[] saves both memory and reduces cache misses. The same is true for types

Re: About std.ascii.toLower

2012-09-20 Thread monarch_dodra
On Thursday, 20 September 2012 at 17:05:18 UTC, bearophile wrote: monarch_dodra: Would that actually change anything though? I mean what with alignment and everything, wouldn't returning a char be just as expansive? I'm not 100% sure. If you are thinking about the number of operations, then

Re: About std.ascii.toLower

2012-09-20 Thread Jonathan M Davis
On Thursday, September 20, 2012 18:35:21 bearophile wrote: > monarch_dodra: > > It's not, it only *operates* on ASCII, but non ascii is still a > > > legal arg: > Then maybe std.ascii.toLower needs a pre-condition that > constraints it to just ASCII inputs, so it's free to return a > char. Goodne

Re: About std.ascii.toLower

2012-09-20 Thread bearophile
monarch_dodra: Would that actually change anything though? I mean what with alignment and everything, wouldn't returning a char be just as expansive? I'm not 100% sure. If you are thinking about the number of operations, then it's the same, as both a char and dchar value go in a register. Th

Re: About std.ascii.toLower

2012-09-20 Thread monarch_dodra
On Thursday, 20 September 2012 at 16:34:22 UTC, bearophile wrote: monarch_dodra: It's not, it only *operates* on ASCII, but non ascii is still a legal arg: Then maybe std.ascii.toLower needs a pre-condition that constraints it to just ASCII inputs, so it's free to return a char. Bye, bear

Re: About std.ascii.toLower

2012-09-20 Thread bearophile
monarch_dodra: It's not, it only *operates* on ASCII, but non ascii is still a legal arg: Then maybe std.ascii.toLower needs a pre-condition that constraints it to just ASCII inputs, so it's free to return a char. Bye, bearophile

About std.ascii.toLower

2012-09-20 Thread bearophile
Sorry, the thread title was "About std.ascii.toLower"...