Did it really have to look like this?
Did it really have to look like this?
For example this:
#[get("/echo")]
fn echo_stream(ws: WebSocket) -> Stream!['static] {
Stream! { ws =>
for await message in ws {
yield message?;
}
}
}
Is not valid Rust code. The `for await message in ws` is particularly egregious.For example, you might learn that you can do `if let Some(foo) = option` to check if some option is Some, but to also extract the value from it. Now you might guess that the let conditionals might work elsewhere, and you'd be right! `while let Some(line) = reader.read()` totally works.
Now compare this to the likes of C, where for example `break` appears in a `switch` for some bizarre reason (yes, I know the actual reason) and `case`s don't have braces.
Some say that Rust naming conventions actually uses snake_case in variables because each underscore is a little trapdoor that's made apparent so you don't fall in it!
Being mainly imperative with some functional and OO niceties, it's also much less weird than many other languages. Try reading some Haskell or Erlang before judging how weird a language looks...
I suspect it might look different. Not better or worse, just.. different. Same core complaints.
Now what if it was written from scratch today? That would prob miss a lot of the warts you don't like. But it still represents a lot of complexity in all the features the language presents, so it wouldn't be Python - for sure.
Personally i love the syntax, but /shrug