On Tue, Jul 17, 2012 at 2:23 PM, Elliott Slaughter
<eslaugh...@mozilla.com> wrote:
> Take, for example, trans/base.rs in the Rust code base. The code uses 
> abbreviations fairly aggressively, including ccx, bcx, icx, ty, ti, insn, 
> ptr, t, incr, sess, among others. None of these are especially difficult to 
> figure out, but the time it takes to get used to the code is non-zero.
>

This could be addressed by better documentation (inline comments or
something else). The advantage of that is that the documentation is
confined to one part of a particular module that no one needs to
re-read once they've learned what the abbreviations mean; in contrast,
everyone pays the cost of using (both typing and reading) long names
over and over.

Also, since in Rust it's usually visually apparent what the type of a
variable is, at least if it's a function argument or a top-level
function, all you really need to do to figure out what "ccx" or "bcx"
means is figure out their types. The piece that's missing right now is
useful documentation for each type.

> Now imagine that third-party Rust libraries follow this example. Now I have 
> to learn abbreviations for every library I use in my application. If for any 
> reason I need to modify a third party library for my own purposes, I'll need 
> to learn its internal abbreviations as well.
>

Likewise, I think that's a documentation issue.

> Should we really be using short name everywhere? And if not, how do we 
> encourage people to use readable names, given the example we are providing in 
> the standard library?

To me, short versus long names are a matter of taste and not something
we should dictate. Different contexts suggest different sorts of
naming conventions. I trust anyone who is sensible enough to choose
Rust to be sensible enough to choose those conventions for themselves
:-)

Cheers,
Tim

-- 
Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt
"Debate is useless when one participant denies the full dignity of the
other." -- Eric Berndt
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to