Naming conventions for functions in similar modules

Jonathan M Davis jmdavisProg at gmx.com
Wed Jun 22 14:06:06 PDT 2011


On 2011-06-22 13:30, Lars T. Kyllingstad wrote:
> On Wed, 22 Jun 2011 09:53:39 -0700, Walter Bright wrote:
> > On 6/22/2011 4:47 AM, Lars T. Kyllingstad wrote:
> >> One problem: std.uni only contains functions for dealing with upper/
> >> lower case and for checking whether something is an alpha character.
> >> If you want the other functions, such as isDigit(), isPunctuation(),
> >> etc. you still have to import std.ascii. And once you have imported
> >> both std.uni and std.ascii, you are forced to disambiguate every time
> >> you call a function which exists in both.
> > 
> > True, but I don't see much of an improvement of:
> > toAsciiLower()
> > 
> > over:
> > std.ascii.tolower()
> > 
> > at least as far as typing goes.
> 
> I agree with that. My point was that maybe std.unit should also have
> functions such as isDigit(), isPunctuation() etc. I suppose we want to
> encourage the use of std.uni over std.ascii in most cases, since D is
> supposed to handle Unicode out of the box.

Oh, std.uni will likely end up with functions for that eventually, but it 
might be a while. In addition to someone actually taking the time to figure 
out the correct way to implement those functions, there's also the question of 
locales. Eventually, we're going to have to figure out how/if we want them to 
figure into std.uni, since that could have a big effect on various functions 
(including those which are already in there).

So, I don't think that there's much question that std.uni should be expanded, 
but it's a lot more work to write the unicode versions than it is to write the 
ASCII versions, and someone has to take the time to do it. If no one else does 
it, I'll probably get around to it eventually, but it could be quite a while 
before that. Time and manpower are really the limiting factors here, not a 
lack of desire to have excellent unicode handling. And then, of course, 
there's the question of what to do about graphemes...

Having someone who's actually both knowledgable about unicode and good with D 
take on such issues would be a big boon for us.

- Jonathan M Davis


More information about the Digitalmars-d mailing list