Arbitrary abbreviations in phobos considered ridiculous

Alex Rønne Petersen xtzgzorex at gmail.com
Tue Mar 6 08:44:01 PST 2012


On 06-03-2012 17:38, 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!
>
>

There's also core.time.TickDuration.currSystemTick() which really ought 
to be currentSystemTicks.

>
> Why aren't we using real words here? Real words are easier
> to remember and easier to type.
>

+1.

>
> 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?

I agree entirely. Phobos (and druntime) needs to follow the same 
convention the .NET Framework does: Always use whole words, and only 
abbreviate if the abbreviation is universally well-known.

-- 
- Alex


More information about the Digitalmars-d mailing list