When did you first realize Rust is a shitty meme language? Pic related

When did you first realize Rust is a shitty meme language? Pic related

Other urls found in this thread:

doc.rust-lang.org/book/casting-between-types.html#numeric-casts
doc.rust-lang.org/book/vectors.html
twitter.com/NSFWRedditGif

C should have done the same with size_t desu

It seems quite good.

what's the problem, brainlet?

Not op, by my issue is with the error message, it should clearly state that indexing must be done with usize. Much of rust error messages are like this. Large numbers of gotchas that could be quickly explained but arent

The second I saw all of it's superfluous syntax they crammed in because MUH SAFETY!
It looks and reads like complete garbage.

...

I kind of know C++
I know pascal, python, php, javascript, decently well

should I learn rust and drop C type languages?

I only use them for certain tasks in micro controllers for probing stuff usually

Learn what usize is about before posting.
>a thread died for this

>cannot be indexed by i32
Seems pretty fucking straightforward to me. How dense are you?

the fact that you think this makes the language a meme (the community does that already) really really shows that you don't know what you're talking about.

There's absolutely no reason not to support implicit conversion from smaller -> bigger int types because there's no possible error case.
And only allowing unsigned indices seems retarded, negative offsets are a completely reasonable and useful thing to have, especially in byte buffers representing nested packet formats.

it doesn't tell what it wants instead

There's more important things to do than to handhold skiddies who won't read the documentation. Just look at which Index traits Vec implements and you'll clearly see it requires a usize.

It doesn't tell you to use a usize here because an object can implement any Index. What if an object implements Index and Index and Index? What should the error say then?

expected Index, got Index

Fuck C++, keep it to C. C++ is for normies. Rust can cross compile to some microcontrollers so it's absolutely worth it.

Sure. You can easily convert a u32 to a u64 since you're just extending the bytes. But usize is dependent on the architecture you're running on. If you try to compile the code to a 16-bit platform, then all of a sudden u32 is larger than usize. If you compile it to a 128-bit platform, then now you've got usize larger than u64.

It could be more verbose but at least its better than C++. People who do systems level programming seem to have a problem with communication. Like a substantial problem with expressing thoughts and ideas.

Most man pages are far too terse or simply lacking important information

C and C++ error messages are nearly fucking useless

I'm too dumb to learn them all
so I should just go with rust?

error messages are compiler specific, please clarify.
i find clang's messages generally less cryptic than gcc's

If you're dumb, then you're probably just going to be fighting with the borrow checker if you learn rust.

This is correct, unfortunately

not an argument.

;(

I guess I'll just stick with python

You're not too dumb to learn C or any other programming language. Yes, it will take longer to learn C unlike Python, Ruby, or any of those high-level languages but it's totally doable.

No languages tell you what they what. What do you think this is, a tutorial?? Theres a problem, it told you whats wrong. Thats exactly what it should do.

In java if you use the wrong type, it wont tell you USE THIS TYPE INSTEAD RETARD, it will tell you "types incompatible" or some shit like that

It doesn't tell what it wants because it doesn't know what it's supposed to want. It found something wrong with what you typed, so stop being an autist and figure it out yourself.

why can't an i32 whose value is in the range of usize be converted to usize, and just give the error when the value is negative?

well I said I kind of know C/C++
I've done some basic stuff like probing thermal sensors and loonix gpio stuff etc

I was just wondering if I should drop my usage of that and change it to rust instead for the same type of stuff, the difference is trivial vs python's speed but when you have like 50 of them running every second the speed increase adds up. Which is the only reason I don't use python for all the shit

You can. Rust has some pretty simple rules regarding numeric casting.

doc.rust-lang.org/book/casting-between-types.html#numeric-casts

Java literally says
Foo.java:8: error: incompatible types: i32 cannot be converted to usize
v.Index(x);

I mean without an explicit cast statement so this would not be an error.

...

Implicit type conversion has no place in Rust. It is a historical feature of classical languages that was deliberately not included.

method Vec.Index(usize) is not applicable
(argument mismatch; banana cannot be converted to usize)
method Vec.Index(i32) is not applicable
(argument mismatch; banana cannot be converted to i32)
method Vec.Index(Box) is not applicable
(argument mismatch; banana cannot be converted to Box)

foo.cpp:15:8: error: no matching member function for call to 'Index'
Vec().Index(banana());
~~~~~~^~~~~
foo.cpp:9:7: note: candidate function not viable: no known conversion from 'banana' to 'i32' for
1st argument
void Index(i32);
^
foo.cpp:10:7: note: candidate function not viable: no known conversion from 'banana' to 'usize'
for 1st argument
void Index(usize);
^
foo.cpp:11:7: note: candidate function not viable: no known conversion from 'banana' to
'Box' for 1st argument
void Index(Box);

So it's a shitty meme language.

Why not make all integer types implicitly convertible and a runtime error if there's an overflow so that people can pretend there's only one integer type like in real languages?

Because Rust doesn't have "runtime errors".

If you honestly think implicit type conversion is good, then you need to take a language theory class.

>a runtime error if there's an overflow
That's not zero-cost.

>hurr overflow check cost
>proceeds to brute force primes

Well it uses hindley milner which is notorious for making it difficult to produce good type errors.
It does a decent job though.

On that same note I think that rust would have a lot to gain but changing up their type system to allow more things, and not using hindley milner, because you really never get to take advantage of the enormous inference power of HM in rust as you would in say, Haskell. And stuff like subtyping / type level values are more useful in a language like Rust

>>proceeds to brute force primes
Of whom are you referring to?

This is actually really bad since some standard library functions are overloaded dozens of times, and calling them with the wrong arguments dumps an incomprehensible mess into the console.
Just try something like
#include
struct s {};
int main(void) {
std::cout

of statically typed languages you can have weakly typed (C) and strongly typed (Java)
apparently Rust is the latter.

Come on user, did you read the doc ?
doc.rust-lang.org/book/vectors.html
> It’s also important to note that you must index with the usize type

Rust might not be perfect yet, but in that case the problem is you.

Knowing what overloads are in scope is still better than having no idea.

An explicit cast is going to turn a negative value into $HUEG, and what happens when you try to index a vector with that?

However be careful: if you try to access an index which isn't in the Vec, your software will panic! You cannot do this:

let v = vec![0, 2, 4, 6];
println!("{}", v[6]); // it will panic!

If we're allowed to panic, why not skip the middleman and just say "converting a negative implicitly to an unsigned panics"?

From the moment I realized it has no decent polling support, and it wants to call itself a systems programming language lmao

Only learn it if you have a genuine need to, I'm useless at learning languages unless i have a real need for it.