Shouldn't have IsAlpha() from std.uni has a different name to avoid confusing from std.ascii?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 21 09:48:05 PDT 2014


On Thu, 21 Aug 2014 18:36:30 +0300
ketmar via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> On Thu, 21 Aug 2014 15:27:46 +0000
> MacAsm via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>
> > Any thoughts? I don't know if I'm missing something but two
> > functions (and not methods) with same name is very bad.
> they doing much the same, but for different character sets. two
> different names will just confuse users.
>
> you can use fully qualified names and/or local imports to use exactly
> what you want.

Exactly. They're doing the same thing but for different character sets, so
they have the same name. You then use the module system to distinguish them.
So, the module system is doing its job. The alternative is to do something
like prefix functions with the module name (e.g. isUniAlpha and isASCIIAlpha),
in which case, we're ignoring the module system, and making the names
unnecessarily long. The module system was designed to deal with conflicts
like this. So, if two functions do different things, we give them different
names, but if they're doing the same thing (as in this case), we give them the
same name.

- Jonathan M Davis


More information about the Digitalmars-d mailing list