Naming conventions for functions in similar modules

KennyTM~ kennytm at gmail.com
Wed Jun 22 07:38:07 PDT 2011


On Jun 22, 11 19:47, Lars T. Kyllingstad wrote:
> 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

Definitely different. std.uni.isDigit should recognize all Unicode 
numerals e.g. 123٤٥٦
(http://en.wikipedia.org/wiki/Unicode_numerals)


More information about the Digitalmars-d mailing list