Rust by Example
A few observations knowing nothing about Rust until I read this, perhaps someone can shed some light on these:<p>THE BAD:<p>* keywords like "let" are extra work for the programmer because the compiler can infer them automatically.<p>* I’m not a fan of printf()-style parameters, because they break ordering (remarkably, php does this best with its “.” and “$” notations).<p>* Mandatory curly brackets are also more work, although they (could) prevent subtle bugs later.<p>* I’m not a fan of the generics syntax, borrowed from templates in c++ (I prefer the something like the “auto” style more, shifting work to the compiler).<p>* Forcing the programmer to manually place values on the heap with “~” is annoying, when other languages can automatically optimize such things.<p>* It seems that move semantics distinguish between objects and primitives, instead of everything being an object?<p>* Borrow is confusing to me, because I would probably make an immutable object passed to a function as mutable create a copy (but maybe it avoids subtle bugs).<p>* Lifetimes completely confuse me, as it seems like they would be handled by garbage collection?<p>* I don’t have a problem with the “static” keyword, except that wouldn’t global immutable variables be static anyway?<p>* I might have gone with traits (interfaces) everywhere instead of distinguishing them from structs, because that seems to be the direction the world is going, to avoid inheritance problems.<p>* I’m not sure I would have distinguished closures from functions with special syntax (although maybe it prevents subtle bugs later).<p>* #[bench] seems a little weird (putting profiling calls in the code), although I do find myself wanting this constantly, so if they conditionally compile they could be handy.<p>THE GOOD:<p>* Real preemptive threads it seems (as opposed to Go’s goroutines which are cooperative threads/coroutines).<p>* UTF-8, non null-terminated strings are good (I wonder how they handle character boundaries though, especially in languages besides English).<p>* Some argument could be made that borrowing c++ concepts makes Rust more approachable.