I'm experimenting with #Rust again, and my eyes always bleed with the "lifetime annotation syntax" - why does it have to use an apostrophe 😩 .

&'a mut i32

fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {

impl<'a> System<'a> for LeftWalker {
type SystemData = (ReadStorage<'a, LeftMover>,
WriteStorage<'a, Position>);

But this time I'll try not to rage quit in digust again. I'll stick until this experiment ends. #rustlang

Another one:
- Generics in every language: Vector<MyType>()

- Rust:

Nope:
Vec<u32>::new();

This works:
Vec::<u32>::new();

And this ALSO works:
(Vec <u32)>::new();

So I can't use the universal language of: Vec<u32>::new();

But I can do (Vec <u32)>::new();

#Rust #rustlang

What kind of syntax is that? For the past 28yrs I used more than 12+ langs in every kind of project & the ugliest language I've seen is Rust.

Yes, EVEN UGLIER THAN ERLANG, at least Erlang is consistent and makes sense.

@alfredbaudisch

Vec::<u32>::new() is a general syntax used for adding generics when calling a function.

(Vec<u32>)::new() does not work because it tries to interpret stuff in () as an expression.

<Vec<u32>>::new() works because <> are like () but for types. This is often used to call a function from a specific trait when multiple options exist. example: trait A has do_thing(), trait B too, but want to call that of trait A:
```
let v = Vec::new();
// these are equivalent due to the argument allowing type inference
<Vec<u32> as A>::do_thing(&v);
A::do_thing(&v);
// this one needs the cast to know which type that implements B to call it on
<Vec<u32> as B>::do_thing();
```

playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0e2187a7649ab5f3caeb1ce56d63970b

Rust Playground

A browser interface to the Rust compiler to experiment with the language

@TudbuT thanks, that was very helpful