Arbitrary abbreviations in phobos considered ridiculous

Adam D. Ruppe destructionator at gmail.com
Tue Mar 6 08:38:09 PST 2012


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?


More information about the Digitalmars-d mailing list