fn accumulate<'a, T: Monoid>(tuples: &[(&'a str, &Fn(i32) -> bool)], i: i32) -> T
where
T: From<&'a str> + From<String>,
this is JUST the function signatureyes, every single thing in there is necessary, it can be written in a more gruesome way, but the where clause clarifies it a bit
But let me cheat a little bit
( $(#[$attr:meta])* enum $enumer:ident { $($i:ident => $e:tt $( ( $($m:ident),* ) )* ; )* } ) => {
how is this macro syntax looking?On the second one you got me though, I find the macro syntax a bit horrible. Sometimes I just want simple text substitution.
I guess the signature could be made more readable by using a few type aliases. The hardest part to read is the nested types.
I'm with you on the macro syntax, it is very hard to read. It is not easy to create a readable macro syntax though. All languages I know have hard-to-read macros, so this is not yet a solved problem.
fn accumulate tuples: &[(&'a Str, &Fn(i32) -> Bool)], i: i32 -> t
where
t: Monoid + From &'a Str + From String,
this is how Haskell with lifetimes and borrowing would look like (if arguments were not curried)It's also not realistically parseable- the Haskell/Ocaml-like removal of <>s and ()s relies on application being left-associative, and if you read this under that rule you've changed the meaning (e.g. `From &'a Str`).
for i in range(100000000):
...creates in memory a list with one-hundred million integers.
Expressive yes, but sometimes it can be double-edged for new comers (and not new comers).
What exactly is terrible about it? The snake_case I got used to, I kind of like having braces, and that's not really a killer argument either, because most languages have them, apart from that I find Rust also much cleaner than Python syntax. I'm really not sure what you mean. Is it the lifetime annotations (because they're somewhat necessary).