Naming conventions for functions in similar modules

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Wed Jun 22 04:47:07 PDT 2011


On Tue, 21 Jun 2011 23:30:49 -0700, Walter Bright wrote:

> On 6/21/2011 10:38 PM, Jonathan M Davis wrote:
>> For example, should we have
>>>> std.ascii.toLower and std.uni.toLower or std.ascii.toAsciiLower and
>>>> std.uni.toUniLower?
> 
> 
> I think we've failed if we have to name things std.ascii.toAsciiLower,
> i.e. having to repeat the module name in the function name in order to
> disambiguate it.

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.

Would it make sense to move or add isDigit and so on to std.uni?  Would 
Unicode-aware versions of these functions be different from the ASCII 
versions?

-Lars


More information about the Digitalmars-d mailing list