Arbitrary abbreviations in phobos considered ridiculous

Bill dolive89 at sina.com
Tue Mar 6 18:28:09 PST 2012


Adam D. Ruppe Wrote:

> One of the stumbling blocks on using std.datetime is how
> many bizarre abbreviations it has.
> 
> auto time = Clock.currentTime(); // bzzt, wrong
> 
> if(time - something > duration!"hours"(4)) // bzzt, wrong
> 
> writeln(time.toISOExtendedString()); // bzzt, wrong, but this 
> used to work!
> 
> 
> 
> Why aren't we using real words here? Real words are easier
> to remember and easier to type.
> 
> 
> This is almost as bad as "creat" and "umount". It's like
> these names are deliberately designed to fail your
> first guess. Our minds are pretty good at remembering
> words and sentences; it is an existing database in there
> that follow established patterns.
> 
> Arbitrary abbreviations only work through special-cased
> brute force rote memorization.
> 
> 
> And the dmd spellchecker doesn't always help:
> 
> Error: template instance duration!("hours") template 'duration' 
> is not defined, did you mean Duration?
> 
> 
> Nope, apparently, I meant "dur". Ridiculous.
> 
> 
> 
> std.datetime isn't the only one that does this, of course.
> rndGen() in the middle of sane names like "unpredictableSeed"
> and "randomShuffle". There's more, too.
> 
> 
> 
> 
> 
> Some abbreviations are justified by precedent. rmdir() has
> been around for a long time, so we know what it is. Stringz
> is similarly classic. "printf" is one of the earliest words
> many of us saw as programmers.
> 
> But "dur"? "curr"?
> 
> 
> What the hell? Can we please stop this?

Agree !!! that this is the the phobos biggest flaw , the lack of a good naming convention . It is time to formulate a good naming convention .

good luck
Bill 



More information about the Digitalmars-d mailing list