eliminate junk from std.string?

Jonathan M Davis jmdavisProg at gmx.com
Tue Jan 11 14:10:38 PST 2011


On Tuesday, January 11, 2011 12:44:57 Nick Sabalausky wrote:
> "Walter Bright" <newshound2 at digitalmars.com> wrote in message
> news:igibu6$154q$1 at digitalmars.com...
> 
> > Ary Borenszweig wrote:
> >> Why care where they come from? Why not make them intuitive? Say, like,
> >> "Always
> >> camel case"?
> > 
> > Because people are used to those names due to their wide use. It's the
> > same reason that we still use Qwerty keyboards.
> 
> Then why switch langauges at all?
> 
> When you move to a different language you expect that language is going to
> have its own set of conventions. And even more than that, you also expect
> it to at least be internally-consistent, not a grab-bag of different
> styles. Are they really supposed to remember "Oh, oh, this func comes from
> this language, so it's capitalized this way, and that one comes from that
> language so it's capitalized that way..."
> 
> Not only that, but D has far, far bigger, more significant differences from
> Ruby/Python/JS/etc than the capitalization of a few functions. If people
> are going to come over and get used to *those* changes, then using toLower
> instead of tolower is going to be a downright triviality for them. Your
> cart is before your horse.

I agree. Having the functions named similarly so that they're quickly recognized 
is good - if a function has a particular name in a variety of languages, why not 
give it essentially the same name in D? But I don't see why it must be _exactly_ 
the same name. At least using the same casing as the rest of Phobos. Unless 
you're directly porting code, the fact that it's toLower instead of tolower 
really shouldn't be an issue. It's a new a language, a new library, you're going 
to have to learn how it works anyway. The function names don't need to be 
_exactly_ the same as other languages. It does look bad when functions in Phobos 
don't follow the same naming conventions as the rest of it, and it makes it much 
harder to remember exactly how they're named.

So, I'm all for picking names which are essentially the same as functions with 
the same functionality in other languages, but I think that insisting that the 
casing of the names match the casing of the functions from other languages when 
it doesn't match how functions are normally cased in Phobos is definitely a bad 
idea. Not to mention, I don't think that I've ever heard anyone complain that 
the casing on a function in Phobos didn't match the casing of a function with 
essentially the same name in another language, but complaints definitely pop up 
about how some of the std.string functions don't use the same casing as the rest 
of Phobos.

I vote for consistency. Using essentially the same names for functions as is 
used in other languages is great. Insisting on the same casing for the function 
names strikes me as inconsistent and undesirable. I find that it increases the 
burden of remembering function names rather than reducing it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list