Naming conventions for functions in similar modules

Chris Molozian chris at cmoz.me
Wed Jun 22 10:12:14 PDT 2011


I'm mostly a listener on the mailing list but I very much agree with 
Walter. Personally I think arguments about typing length are daft in an 
age with IDEs and language tooling. The most important aspect of the 
naming convention IMHO is readability and intuitiveness. I like the idea 
of naming the functions in different modules with the same pattern if 
they complete the same task (albeit in different ways or on different 
types of data... etc).

There's a lot of options for disambiguating naming clashes in the language:

  * aliasing
  * renamed imports
  * selective importing from a module
  * fully qualified names (e.g. std.ascii.toLower() )

That's my two cents,

Chris


On 06/22/11 17:53, 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110622/217108bd/attachment.html>


More information about the Digitalmars-d mailing list