Rust Supremacy Thread

We must secure the relevance of our language and a future for rust programmers.

Join the future of systems programming

rust-lang.org/

Other urls found in this thread:

blog.rust-lang.org/2017/04/27/Rust-1.17.html
internals.rust-lang.org/t/diversity-on-the-governance-teams/2048
github.com/rust-lang/rust-www/issues/268
github.com/rust-lang/rust/issues/40858
tockos.org/
freesoftwarefoundation.org/read/prog/1423793249
twitter.com/SFWRedditVideos

Dude I like the language myself, but stop with this shilling. Do something with instead.

blog.rust-lang.org/2017/04/27/Rust-1.17.html
545 points on HN, are other programming languages even trying?

>545 points on HN

Relevance is inversely proportional with HN points.

Hn is full of rust shills. Meanwhile rust has still 0 (zero) useful applications written in it. SAD!

Both CERN and ESA use Rust.

Also Steve Klabnik is a qt.

>X uses rust and I like x so it must be good
>Am gay

Rust is shit for productivity, why would I waste my precious time

I'm learning rust. I hate to admit, it is really a massive pain in the ass to do the simplest of the things. Maybe because C/C++/D made me very lazy.

For example try implementing a function that prints the sum of all square number under 1 Million.

On C:
#include

int main()
{
size_t total = 0;
int i;
for (i = 0; i < 100000; i++)
{
int j;
for (j = 0; j < i / 2; j++)
{
total += (j * j == i) ? j : 0;
}
}

printf("%lu\n", total);
return 0;
}
On D:
import std.stdio;

void main(string[] args)
{
size_t total = 0;
for (int i = 0; i < 100_000; i++)
{
for (int j = 0; j < i / 2; j++)
{
total += (j * j == i) ? j : 0;
}
}

writeln(total);
}

Now let's see Rust's version, please follow the same algorithm for a level playing field. I want to bookmark the three languages now: in terms of code readability/productivity and speed.

CERN does most of their work in C++ using the ROOT framework
There is also a shit ton of legacy FORTRAN they use.

fn main() {
let mut total = 0;
for i in 0 .. 100_000 {
for j in 0 .. i / 2 {
total += if j * j == i { j } else { 0 };
}
}
println!("{}", total);
}

As written, it sums all squares under one hundred thousand, not one million. Is that what you intended?

>100_000

C really is the best

1/10 made me respond as someone who'd like C to go.

Saged, reported, hidden, called the mods, emailed chinkmoot, emailed the admin, called the cops, called the state police, called the county sheriff, called your ISP, called the District Attorney, called Interpol, called the NYPD, called the State Attorney, called the LAPD, called Child Protective Services called the FBI, called US Homeland Security, called the CIA, called the NSA, called the US Marshals, called the local courthouse, called your State Constable, called London Metropolitan Police, called the German Police, called the TSA, called the US President, called the attorney general, called the National Guard, called the US marines, called the US Navy, called the US Air Force, called the US army, called the Royal Navy, called the governor of every state, called the Federal Air Marshals, called every sheriff deputy, called the Coast Guard, called the US Customs and Border Protection, called the RCMP, called every park ranger, called the mayor of every city in France, called the British Army, called the Queen, called NATO, called the Russian Air Force, called the Federal flight deck officers, called the UN, called the Corrections Department for every state, called the Australian Federal Police, called SWAT, called the Supreme Court, called the Mexican Police, called the White House, called the DEA, called the inspector general, called the Secret Service, called CNN, called ABC, called the vice president, called the senators for every state, called congress, called the pope, called CHP, called the Department of Fish and Wildlife for every state, called the internet police, called the US Capitol Police, and called the Party Van.

>100_000
this is haram

internals.rust-lang.org/t/diversity-on-the-governance-teams/2048
>Diversity on the governance teams
>the level of diversity on the teams is low: in particular there appear to be no women on any of the sub-teams
>As a member of the moderation team, I really really think this must change. There are many reasons, but for the moderation team in particular I don't think we can be maximally effective at helping to uphold the Code of Conduct without a more diverse team. For example, gender bias and gendered harassment are a huge problem in online communities and open source. The moderation team is explictly supposed to fight sexism, racism, and other discrimination. We could see, anticipate, and respond to such issues much better if we had more than just male perspectives on the team.
>women and minorities are under-represented in the Rust project and broader community. This is not an excuse; it points to a bigger problem that we also need to solve.
>We can and should build a team now that can best serve the diverse community we want to welcome.
>This means looking beyond the group of people who have been most active or visible in the past, and creating more opportunities for new people to come into the project to build its future.
>I want the best possible moderation team for the Rust community, and I believe that means replacing a too-narrow process with a more inclusive one.
>I personally would be happy to be replaced by someone picked from a larger pool of qualified candidates, and want to find the best way to make this happen.
>I don't however want to succumb to the common problem of asking women, people of color, and other victims of discrimination to do disproportionate or unpaid work to fix problems they didn't create.

This is pure supremacy. Even more so if you place it like 1_00_0000_0_1_00000 in somefucks else codebase.

>I was struggling to come up with more than 4 not-cis-man active members (that is, publicly not-cis-man, there may be people who have kept their gender private) of the Rust community, and this was when I included people who used to be active but aren't anymore. That's doubleplusungood.
>Diversity on the mod team is very important, and I hope we can work towards a solution to that.

github.com/rust-lang/rust-www/issues/268
>Gender Identity & Expression in the Code of Conduct
>I just filled in an issue over in Node.js about including 'gender identity and expression' into their Code of Conduct: nodejs/inclusivit
>I know that Node effectively adopted the Rust CoC so I thought I should come over here and suggest the same thing
>I am proposing that we include 'gender identity and expression' in the Code of Conduct used for all of Rust. I've managed to include this in the Codes of Conducts for several event and online communities of a smaller nature
>Solely referring to 'gender' does not recognise the non-binary or agender folk. (As often, 'gender' is widely regarded as the popular idea of man/woman). Gender identity feels like a clearer and more inclusive term.
>I realise the CoC says 'similar personal characteristic', but it feels like it'd be good to have things explicitly said rather than assumed. The Contributor Covenant has a lot of really useful things in it too (like age, technology choices, lack of religion), which we could consider co-opting things from.

>this is clearly within the spirit and intent of the original CoC, and I have no objection to spelling it out more explicitly.

>It's really encouraging to see so many +1's thank you all.

I wish I had that in C

>for j in 0 .. i / 2
>i/2
>u32/i32
hmm

/tmp$ cat main.rs
fn main(){
println!("Hello world");
}
/tmp$ time rustc main.rs
real 0m0.387s
user 0m0.288s
sys 0m0.108s


~0.3 seconds to compile hello world? You can't be serious. it's worse than C (0.03) and two C++(one 0.06 with printf, second 0.15 with iostreams) combined.

Fast compiler where?

Compilation speed is none of Rust's concern

And it takes me like .02 seconds here, go be a poorfag somewhere else

>benchmarking compiler startup times

Fuck you all!

Ayyyy

Now I definitely will never use it. Its essentially going to produce another generation of shit programmers JUST LIKE JAVA DID!

>Its essentially going to produce another generation of shit programmers JUST LIKE JAVA DID!
Elaborate

No it won't, because nobody uses rust in enterprise.

>for j in 0 .. i / 2
Try again. It crashes the program

> Implying that dropping probably more than half of my CPU's cores to have slightly better time on fewer cores is a good choice

> Ignoring that slow compilation time was always rust problem
> Pretending e.g. github.com/rust-lang/rust/issues/40858 does not exist
> being in such of the denial

>Rust

Why do they always give languages such shitty names? It should be something awesome, like XxXbLaD3xXx2004

>Ignoring that slow compilation time was always rust problem
It sure is, just not for hello worlds.

Slow compiler is not a Rust only problem. Also, as I just said, compilation time is none of Rust's goal. You are just wasting your energy there

>It should be something awesome, like XxXbLaD3xXx2004

>i/2
wat?

also
>not using bit shift operator

If the root doesn't exist in the first half of multipliers it doesn't exist in the rest half

range of i is already known, why do you need to check half? limit it to 1000

Manual optimizations would decrease the performance gap in benchmarking though

learn to think clearly first

huh?

>a language that competes with python in speed
Aren't you in the wrong thread?

Donald pls go

There is no god but Rust! Steve Klabnik is the messenger of Rust!

At work I program C for Cortex M devices, using a non-userspace RTOS. I was searching for embedded OSes for Rust, and only this one came up: tockos.org/
Has anyone here tried it? It seems board support is pretty lacking.

Hi! :)
Please remove your post because it satirizes Islam and we don't tolerate Islamophobia in our community.
Bye! :)

dude looks like skrillex

rust and things made in rust are both pretty immature still

probably the big unspoken reason why nobody is using it outside of a few meme companies yet

>unspoken
It is well known that changing your companys development language is huge leap.
>need to train your workforce
>maintain old code
>interface between new lang and old code
>all the other problems that come with new lang

Rust has potential but the politics are killing the kind of adoption is needs to become really popular

fn main() {
let total = (1..100000).map(| i | (0..(i/2)).filter(|&j| j*j==i).sum()).sum();
println!("{}",total);
}

What?

consider giving `total` a type
| cannot infer type for `_`

Right, that's just a
let total : i64 = ...

Which should work for any particular integer type you want. The solution is generic.

Still doesn't compile though


Okay the results are in:
user0@primary:~/devel/proj/test-c$ cat test.c && gcc -O2 test.c && time -p ./a.out
#include

int main()
{
size_t total = 0;
for (int i = 0; i < 100000; i++)
{
for (int j = 0; j < i; j++)
{
total += (j * j == i) ? j : 0;
}
}

printf("%lu\n", total);
return 0;
}
50085
real 8.15
user 8.15
sys 0.00
user0@primary:~/devel/proj/test-c$
user0@primary:~/devel/proj/test-d$ cat main.d && ldc2 -O2 -release main.d && time -p ./main
import std.stdio;

void main(string[] args)
{
size_t total = 0;
for (int i = 0; i < 100_000; i++)
{
for (int j = 0; j < i; j++)
{
total += (j * j == i) ? j : 0;
}
}

writeln(total);
}
50085
real 7.53
user 7.52
sys 0.00
user0@primary:~/devel/proj/test-d$
user0@primary:~/devel/proj/test-rs/test1/src$ cat main.rs && rustc -O main.rs && time -p ./main
fn main() {
let mut total: i32 = 0i32;
for i in 1..100_001 {
for j in 1..i {
total += if (j*j) == i {j} else {0i32};
}
}
println!("{}", total);
}
50085
real 2.61
user 2.61
sys 0.00
user0@primary:~/devel/proj/test-rs/test1/src$


Very controversial

>didn't read the op
>literally white supremacist wording
>waaahh dont insult muh islam get out of our "community"
this is why no one can take rust seriously along with shit compile times and pretending and failing to be memory safe.

Ah sorry, the inner sum() needs a type hint as well. Serves me right for writing code without running it.

This works though:
fn main() {
let total = (1..100000).
map(|i| (0..(i)).filter(|&j| i==j*j).sum::())
.sum::();
println!("{}",total);
}

meant 0..(i/2) ofc.

Looks worse than desu

what is this shit

Eh, that's a matter of taste. A program written using map & filter is easier to break up into reusable functions. Both imperative and functional styles are valid approaches.

Senpai could you please rustfmt that

Is it actually good enough to use? Last I checked it seems like the designers might still suddenly change stuff around.

rust seems like a low level scala. and by that i mean it has a steep learning curve. am i correct?

Don't be fooled. Rust doesn't invent anything that wasn't already in Ada and C++. Its sole purpose is to be political.
Make sure you never use it. If your company wants to introduce it, quit.

Rust is garbage. Never before have I seen a language with hundreds of thousands of shills shilling it everywhere they go.

freesoftwarefoundation.org/read/prog/1423793249

It's not such a huge leap for smaller companies who built all their shit in something like Python or Ruby - they can replace parts of their backend with standalone Rust programs for huge performance gains with only modest effort.

Not so appealing if you're working on a huge C++ or Java codebase though

(((Rust))) is made by the (((SJWs))) at (((Mozilla))).

>Never before have I seen a language with hundreds of thousands of shills shilling it everywhere they go.

Golang is worse.

But I dislike both of them.

Pattern Matching.

u 8 the gr8 b8, m8

I want to like it, but these. It needs to be more mature and feel more permanent.

>Last I checked it seems like the designers might still suddenly change stuff around.
Yes, they do this frequently. Code that's more than a few weeks old will not compile.

So where would i want to use rust? Shills are mostly saying it will replace C, but... It's unusable for embedded. It doesn't have the tooling C has to write safe code and, probably never will.

It's good for hobby projects, and that's about it.

>a future for rust programmers
hahahahahhahahah

Golang is actually pretty sweet for backends. As with C, the lack of generics is not a problem. Biggest issue imho is the imports bullshit.

they also use C, C++, python, java, javascript and a few more..
its almost like different tools for different jobs or something

Complex languages never caught on. Why would Rust?

>C++
>never caught on

C++ isn't complex. It's C with bloat.

If C++ isn't complex, neither is Rust.

It's complex when people use that bloat together. Just got a new job working on an 18 years old C++ codebase where the leads thought it's a good idea to implement every goddamn bullshite feature of the goddamn language. Fml

Rust has all kinds of arbitrary rules regarding memory management.

Based on this alone Rust is dead to me and I will oppose it every where I can in every way I can, even if I have to resort to FakeInfo about its performance or suitability for a project.

Fuck Rust.

Rust has the same rules as C++, but instead of enforcing them in your head the compiler does it for you.

That's literally wrong.

That's not true. The borrow checker is known to reject valid, memory safe, code.

And this happens because the borrow checker is overly conservative, since not being conservative enough would be useless.

It is a trade-off I am willing to make, but I understand other people might not want to.

>overly conservative
No, it's just too dumb to understand the context.

rust is a good language to learn from but its either going to need a decade to refine or Rust++ to do its borrow checker better.

I agree with you.

What I mean by "overly conservative" is that if the borrow checker can't reach the conclusion (because it is dumb) then it will reject the program.

So, why would I entrust memory safety to a faulty borrow checker?

Because it won't accept a memory unsafe program (unless you use an unsafe block).

It isn't faulty in the sense that it will accept an unsafe program, it's fault because it rejects a subset of safe programs. This is more useful than the inverse (for me).

>Because it won't accept a memory unsafe program (unless you use an unsafe block).
There's never been formal proof of that.

You are correct, and someone in Europe is working on proving that (among other things) at this moment.

Every time there's a problem with Rust, the standard response is "someone's working on it." Meanwhile there are stable languages you can get jobs with. Have fun with your vaporware.

I don't think the borrow checker will pass. If it does though, chapeau.

Hey guys, rate my fizzbuzz:

fn fbString(i : i64) -> (*const str, Option) {
match (i%3,i%5) {
(0,0) => ("FizzBuzz" as *const str,None),
(0,_) => ("Fizz" as *const str,None),
(_,0) => ("Buzz" as *const str,None),
_ => {let x = i.to_string();
let px = &x as &str as *const str;
let bx = Box::new(x);
(px,Some(bx))}
}
}


fn main() {
let n = 50;
for i in 0..n {
let (poutput,tehBox) = fbString(i);
let output = unsafe {&*poutput};
println!("{}", output);
} // Box contents are nuked here.
}

not idiomatic enough.

>Option
Not enough layers, you need to go deeper
Option

Changing tehBox to _ causes this to dereference a dangling pointer, but keeping it named is safe. Well done.