reddit.com: first Chapter of TDPL available for free

Jeremie Pelletier jeremiep at gmail.com
Sun Aug 9 23:13:51 PDT 2009


Daniel Keep Wrote:

> 
> 
> Andrei Alexandrescu wrote:
> > Michel Fortin wrote:
> >> On 2009-08-09 11:10:48 -0400, Andrei Alexandrescu
> >> <SeeWebsiteForEmail at erdani.org> said:
> >>
> >>>> It's also arguable that all functions in std.string should take
> >>>> const(char)[]. Or, you know, const(T)[], since D supports encodings
> >>>> other than UTF-8, despite what std.string leads you to believe.
> >>>
> >>> Yah, I think they should all be parameterized so they can work with
> >>> various character widths and even encodings.
> >>
> >> But shouldn't they work with *ranges* in general, a string being only
> >> a specific case?
> > 
> > That's true as well! In my dreams, me and the famous actress... oh wait,
> > wrong dream. In my dreams, I eliminate std.string and put all of its
> > algorithms, properly generalized, in std.algorithm, to work on more than
> > just arrays, and more than just characters.
> > 
> > Andrei
> 
> How do you define 'tolower' on non-characters?

You don't, character-specific functions can test for the element type to be a character type, be it an array or a range.

If you want to use tolower with a non-character array, you have to cast it to a string type.



More information about the Digitalmars-d mailing list