Re:Rust for Embedded C Programmers
by ryukoposting on Monday January 24, 2022 @06:23PM
(#30065577)
As a cranky (but not old) embedded C developer, I'm with you. Rust has a lot of great ideas, and it's a hell of a lot more readable than modern C++, but it's still like reading hieroglyphics sometimes.
1) Really short keywords and basic type names - pub, mut, fn, impl, i8/i16/i32, etc. They're not hard to understand on their own, but in practice they make the language visually choppy.
2) Maybe it's because I learned Kotlin and Typescript shortly before taking on Rust, but "->" feels inconsistent with the rest of the language. It should be a colon.
3) Rust's if statements follow the normal "if <condition> { <result> }" syntax. Yet, for some reason, each branch of a match statement goes "<condition> => <result>." What would have been wrong with "case <condition> { <result> }"? I know it's more characters, but putting a keyword at the beginning of the block would help to visually separate each branch.
4) Rust's closure syntax looks strange (and I've used Ruby before). Maybe that's just me, though.
Rust isn't perfect, but I don't want to discourage other embedded C programmers from giving it an honest shot. The embedded library support isn't really there yet, but the language itself is a huge upgrade over C and C++.
1) Really short keywords and basic type names - pub, mut, fn, impl, i8/i16/i32, etc. They're not hard to understand on their own, but in practice they make the language visually choppy.
2) Maybe it's because I learned Kotlin and Typescript shortly before taking on Rust, but "->" feels inconsistent with the rest of the language. It should be a colon.
3) Rust's if statements follow the normal "if <condition> { <result> }" syntax. Yet, for some reason, each branch of a match statement goes "<condition> => <result>." What would have been wrong with "case <condition> { <result> }"? I know it's more characters, but putting a keyword at the beginning of the block would help to visually separate each branch.
4) Rust's closure syntax looks strange (and I've used Ruby before). Maybe that's just me, though.
Rust isn't perfect, but I don't want to discourage other embedded C programmers from giving it an honest shot. The embedded library support isn't really there yet, but the language itself is a huge upgrade over C and C++.
(edit: I, for one, like the 'lifetimes.)