[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

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

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 49
Thread images: 3

File: works doesnt ok.jpg (77KB, 1125x817px) Image search: [Google]
works doesnt ok.jpg
77KB, 1125x817px
When did you first realize Rust is a shitty meme language? Pic related
>>
C should have done the same with size_t desu
>>
It seems quite good.
>>
>>59797370
what's the problem, brainlet?
>>
>>59798682
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.
>>
File: tarjan666.png (662KB, 960x720px) Image search: [Google]
tarjan666.png
662KB, 960x720px
>>59797370
>>
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
>>
>>59797370
Learn what usize is about before posting.
>a thread died for this
>>
>>59798781
>cannot be indexed by i32
Seems pretty fucking straightforward to me. How dense are you?
>>
>>59797370
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.
>>
>>59798682
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.
>>
>>59798856
it doesn't tell what it wants instead
>>
>>59798909
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<type>. What if an object implements Index<i32> and Index<usize> and Index<Box<String>>? What should the error say then?
>>
>>59799117
expected Index<x || y || z>, got Index<banana>
>>
>>59798812
Fuck C++, keep it to C. C++ is for normies. Rust can cross compile to some microcontrollers so it's absolutely worth it.
>>
>>59798886
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.
>>
>>59799117
>>59798909
>>59798856
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
>>
>>59799151
I'm too dumb to learn them all
so I should just go with rust?
>>
>>59799230
error messages are compiler specific, please clarify.
i find clang's messages generally less cryptic than gcc's
>>
>>59799243
If you're dumb, then you're probably just going to be fighting with the borrow checker if you learn rust.
>>
>>59799323
This is correct, unfortunately
>>
not an argument.
>>
>>59799323
;(

I guess I'll just stick with python
>>
>>59799360
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.
>>
>>59798909
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
>>
>>59798909
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.
>>
>>59799117
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?
>>
>>59799402
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
>>
>>59799518
You can. Rust has some pretty simple rules regarding numeric casting.

https://doc.rust-lang.org/book/casting-between-types.html#numeric-casts
>>
>>59799465

Java literally says
Foo.java:8: error: incompatible types: i32 cannot be converted to usize
v.Index(x);
>>
>>59799592
I mean without an explicit cast statement so this would not be an error.
>>
File: windowsdoeseverythingright.png (22KB, 295x237px) Image search: [Google]
windowsdoeseverythingright.png
22KB, 295x237px
>>59799501
>>
>>59799626
Implicit type conversion has no place in Rust. It is a historical feature of classical languages that was deliberately not included.
>>
>>59799117
    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<String>) is not applicable
(argument mismatch; banana cannot be converted to Box<String>)


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<String>' for 1st argument
void Index(Box<String>);
>>
>>59799777
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?
>>
>>59799860
Because Rust doesn't have "runtime errors".
>>
>>59799860
If you honestly think implicit type conversion is good, then you need to take a language theory class.
>>
>>59799860
>a runtime error if there's an overflow
That's not zero-cost.
>>
>>59800235
>hurr overflow check cost
>proceeds to brute force primes
>>
>>59798781
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
>>
>>59800273
>>proceeds to brute force primes
Of whom are you referring to?
>>
>>59799794
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<iostream>
struct s {};
int main(void) {
std::cout << s();
}
>>
of statically typed languages you can have weakly typed (C) and strongly typed (Java)
apparently Rust is the latter.
>>
>>59797370
Come on anon, did you read the doc ?
https://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.
>>
>>59800536

Knowing what overloads are in scope is still better than having no idea.
>>
>>59800235
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
>>
>>59799243
Only learn it if you have a genuine need to, I'm useless at learning languages unless i have a real need for it.
Thread posts: 49
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.