I've been working on a NES emulator in rust and so far I really like the language.
Other than managing lifetimes, which can be difficult, the only thing that really bugs me is the lack of safe type promotion. for example, if I have:
fn add(a: u8) -> u16 {
a + 7
}
the compiler should not complain that the expression is of type u8 and not u16 - it is safe to widen the type!
Other minor nits:
- it would be nice if enums were scoped. I think putting names in the outer namespace repeats a poor design in C. Enums should look like MyEnum.MyValue. I know the ADT nature of rust enums might throw a wrench in this
- I really dislike the word "mut". it looks like mutt to me. I don't really know how to fix this, though. Perhaps reuse the @ sigil once it goes away?
- Once macros are mature, it would be nice not to require them to be suffixed with !. I'm a lisp guy at heart in this respect... macros should be full power and macro use should feel just like that feature was built into the language
- JSON style literals for hash maps would be nice
- Ternary operator pls
Other than those small complaints, I have to say that rust has been a joy!
See? It would get tedious fast with match pattern.
I had never had problems with mut. The syntax is clear and unambiguous. It's fine as is really. I actually like knowing which pointers are mutable, by keyword instead of typing arcane stuff like @~ptr, @&ptr. Seeing how @ was a sigil for pointers this would make most people do a double somersault in fear of the GC pointer returning.
I like macros with ! It tells you magic happens here beware. Not having those you'd have serious problem understanding where errors are once macro expands :?
Ternary operator? Wth? You can just use if as a superio ternary (endless chaining) operator.
I agree; it was probably an error to mix those types (though one that will probably raise errors elsewhere should it genuinely be problematic) and it makes everything clearer if it must be explicit.
Other than managing lifetimes, which can be difficult, the only thing that really bugs me is the lack of safe type promotion. for example, if I have:
fn add(a: u8) -> u16 { a + 7 }
the compiler should not complain that the expression is of type u8 and not u16 - it is safe to widen the type!
Other minor nits:
- it would be nice if enums were scoped. I think putting names in the outer namespace repeats a poor design in C. Enums should look like MyEnum.MyValue. I know the ADT nature of rust enums might throw a wrench in this
- I really dislike the word "mut". it looks like mutt to me. I don't really know how to fix this, though. Perhaps reuse the @ sigil once it goes away?
- Once macros are mature, it would be nice not to require them to be suffixed with !. I'm a lisp guy at heart in this respect... macros should be full power and macro use should feel just like that feature was built into the language
- JSON style literals for hash maps would be nice
- Ternary operator pls
Other than those small complaints, I have to say that rust has been a joy!