Rust updates

David Piepgrass qwertie256 at gmail.com
Wed Jul 11 09:45:16 PDT 2012


>> Short keywords are only important with barebones editors like 
>> a default vi.
>> Nobody would use this for real development.
>
> I started I long discussion on Reddit, because I complained 
> that the goal of 5 letter keywords is primitive, and brings 
> back memories of the time the compilers were memory constraint.
...
> As someone that values readable code, I don't understand this 
> desire to turn every programming language into APL.

Short or long, I don't think it matters if the IDE can help you 
with the long ones. I don't mind typing immutable, once, but if I 
had to do it 50 times a day? And somehow, even though I have been 
programming for over 20 years, I still type "reutrn" and "retrun" 
all the damn time! So "ret" would save me time.

Anyway I think short vs long is much ado about nothing. No one 
complains that we have to type "int" instead of "integer", after 
all. Most languages have only a few keywords, which people 
quickly learn. As long as all the standard library functions are 
well-named, I don't care about the language keywords.

Actually I think "fn" for functions is great, why?

1. Greppability. With the C syntax there is no way to search for 
function definitions. Even if we had an IDE to find functions for 
us, you are not always looking at source code in an IDE (you 
could be browsing a repository on the web)
2. Easier to parse. When the compiler sees "fn", it knows it's 
dealing with a function and not a variable or an expression. It 
seems especially beneficial inside functions, where perhaps X * Y 
might begin an expression (or is that impossible in D?)
3. Googlability. "function" will find results across all PLs, 
"fn" will narrow the search down quite a bit if you want to see 
code in Rust.

These benefits (except 3) all exist for "function" as well as 
"fn", but while many languages use "fun", requiring "function" 
for all functions is almost unheard of (at least I haven't heard 
of it), why? It's too damn long! We write functions constantly, 
we don't want to type "function" constantly.


More information about the Digitalmars-d mailing list