What are you working on? - Programming On Unix
Users browsing this thread: 49 Guest(s)
|
|||
Slightly OT, but, since you asked me ...
The one big "whoa" with Rust is Cargo. I wish I had something like Cargo.toml for my usual go-to languages: Supplying a Cargo file with the source code is probably the nicest possible way of deploying projects with a number of external dependencies. Comparing that to Makefiles (with all the "download, prepare and find these 365 libraries first" stuff) makes me wonder why it has to be so complicated in every other language I know. The language's syntax, however, is bizarre: 1. unwrap() weirdness Why does everything have to be "wrapped" in weird "types" like Option<> and Box<>? One of the first thing I tried was a simple "print_usage()" method that cuts the path (./myApp instead of /my/very/long/and/boring/path/containing/the/myApp). Adequately easy in sane languages, annoying in Rust: Path::new(program).file_name().unwrap().to_str().unwrap() (It is well possible that there are more elegant approaches to this. But I totally lost my interest in figuring them out.) 2. everything is a macro In theory, there is nothing wrong with that, but it feels wrong that even "println" is not a function. 3. Haskell, Haskell everywhere I was hoping that Rust could be "like C++, but better" - but it is quite different than C++, it rather mimicks as a F#/Haskell sibling with its underscores and its arrows and the lambda stuff. Functional programming sucks. (YMMV.) 4. variables are immutable A variable is called a variable because its contents can vary. If they can't, it's a constant. Except in Rust where everything is a constant by default unless marked otherwise. Why? 5. string confusion Strings are not &strs are not pointers. Who said C's string handling was complicated? 6. no global static variables ... except if you add lazy_static or something - which prefers vectors and arrays but struggles with strings. Maybe there are easier ways to provide static runtime "variables" (mutables...), but I just haven't found out how. The documentation could be better IMO. But then again, I only spent Saturday and half of Sunday with Rust - including some sleep. It might well be because of my limited understanding of the "good design" of Rust or something, but I felt it would require more than just a weekend to even understand something roughly more complicated than "Hello World". I probably gave up rather fast, but, as it stands, Rust is not quite as friendly as Cargo made me think initially. That's sad, but I can live with that. -- <mort> choosing a terrible license just to be spiteful towards others is possibly the most tux0r thing I've ever seen |
|||