[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]

RUST

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: 324
Thread images: 26

File: official-rust-logo.png (11KB, 299x299px) Image search: [Google]
official-rust-logo.png
11KB, 299x299px
Name one flaw with Rust that isn't actually a feature.

> tfw can't
>>
usability
>>
File: 1327280990317.jpg (64KB, 246x235px)
1327280990317.jpg
64KB, 246x235px
>>59576529
>it's not a bug, it's a feature!
>>
Social Justice
>>
>>59576597
most of the sjw's left. Rust is mostly full of russian (for better or worst)
>>
File: linux-desktop-kde-xfce.jpg (10KB, 200x200px) Image search: [Google]
linux-desktop-kde-xfce.jpg
10KB, 200x200px
>>59576619
They make good Linux distros
>>
>>59576570
Show me how it's more usable than C, C++.
>>
>hello world 12 MB
>>
>>59576658
Rust is not really competing with C, it makes more sense to compare it to C++.

With that said Rust is more usable than C++ because:

The stronger type system makes it more readable.

You have OCaml match expressions.

Everything is immutable by default so it's easier to do concurrent and parallel programming.
>>
>>59576727
Hello world size masturbation is stupid, there are a bunch of blog posts showing how to get an hello world in Rust way smaller than one in C.
>>
>>59576727
> can't handle a 12MB file
>>
>>59576727
It's actually 3.6 on a 64bit system.
>>
>>59576529
Solution nobody want.
>>
>>59576962
I hear the cries of video game memory leaks everywhere.
>>
>>59576529
>bugs are features, stupid goyim
Really fires up the neurons
>>
Bump. I'm learning c++ to become a good meme master, but the dankest meme are all about rust and go nowadays.

I'm concerned about the build system. What if cargo (or the website behind it) dies? Are we going to clone and compile every library by hand?
Is rust actually portable or do you need to fuck around with #ifdefs ?
Is there a decent amount of learning material? C++ has a lot of good tutorials / references, but what about rust?
>>
>>59577017
>What if cargo (or the website behind it) dies?
if cargo dies, rust dies, it's literally part of the same project, maintained by the same people.
>>
>>59577017
If cargo (the website) dies, then you can replace the dependency version with the git repo URL.

If rust (the project) dies, then
>>59577035
>>
>>59576755
let x = 10;
x = 5; //Error

Rustfags eternally B T F O
>>
>>59577284
Meant for >>59576529
>>
>>59577284
What are you even trying to show?
>>
>>59577302
Rust's retardation
>>
>>59577284
It's immutable by default in case you don't want to change it. That way it can be handled by multiple threads and it is SAFE.

let mut x = 10;
x = 5;


Was that so hard?
>>
>>59577349
let mut if you want it to be mutable. Vars are immutable by default.
>>
>>59577357
>>59577370
>you need special keyword just to edit variable
>>
>>59577479
This should be the other way around. Dumb design.
>>
>>59576984
Rust will not fix memory leaks, Rust developers think memory leaks are "safe" so they don't worry about them, Rust is full of leaking memory!
>>
I am a white cis heterosexual male, so I'm not allowed to use Rust. Oh well.
>>
>>59577479
why is that an issue? Those who prefer immutability in programs would complain that you need special keywords for values, who gives a shit about something so trivial?
>>
>>59577479
>>59577504

Only a retard things deliberated mutability is a good idea.

Mutable variables are harder to reason about, harder to make work in parallel, impossible to make work concurrently, more error prone.

Mutability is something you have to use only when you are sure you need it, not the other way around.
>>
>>59577586
THIS
>>
>>59577586
what if you aren't using concurrency or parallelism?
>>
File: xkcd_citation-needed.jpg (33KB, 600x600px) Image search: [Google]
xkcd_citation-needed.jpg
33KB, 600x600px
>>59577525
>>
>>59577652
Rust is not a video game language because it's not bare metal.
>>
>>59577647
If you're making a library, you want the highest number of people to be able to use what you made. Some of those people will need concurrency.

If you're not making a library, the syntax is the same so as to not confuse programmers. Plus, it's a pinch faster than using mutable variables.
>>
File: screenshot-C4qwN5rR.png (17KB, 497x306px) Image search: [Google]
screenshot-C4qwN5rR.png
17KB, 497x306px
>>59577672
if it's not bare metal, how did someone make an OS out of it?
>>
>>59577687
Anyone can make a fake OS in a web browser, that doesn't make web browsers bare metal.
>>
File: screenshot-BQeSc3RV.png (166KB, 396x518px) Image search: [Google]
screenshot-BQeSc3RV.png
166KB, 396x518px
>>59577707
> Didn't even download the ISO to verify
>>
>>59577707
That's only true because we don't (yet) have processors that can run JavaScript natively. But Rust compiles to x86 machine code, and is expressive enough as a language to write an operating system in.
>>
>>59577576
>Those who prefer immutability in programs would complain that you need special keywords for values
I didn't see them complain that you need special keywords for immutables or constants in any other language.
>>59577676
>If you're making a library, you want the highest number of people to be able to use what you made.
Then write it in C, so it will be available to both C and C++ users. Not some meme-tier language.
>>
>>59577707
It's not a fake OS, you moron.

>>59577755
> 1972
> Then write it in <Assembly>, so it will be available to all prgrammers, not some meme-tier C language.
>>
>>59577755
Implementing concurrency in C is harder than in rust, which was built with concurrency in mind.
>>
>>59577793
The difference is, C compiles to assembly and uses the same library format and no runtime, Rust has a runtime, it doesn't compile to C.
>>
>>59577811
You don't need to compile to C if you can wrap from Rust to C.

And it's better than C to Rust because muh concurrency.
>>
Rust is pretty ok until "muh safety" takes priority over actually making progress on your problem.
>>
>>59576529
The only answer is immaturity, nightly is adequate for any size project but stable is not good.

Also as a result of that there's not a lot of optimization optimization for binaries.
>>
>>59577932
>optimization options
>>
>>59577795
They can use C++ which simplifies concurrency. Also, why would it matter to you if concurrency is hard to do if you're not using it? It's the user's problem, not your. Writing it in meme language just because it's easier to do concurrency when you're not using concurrency is retarded.
>>59577793
At least C was an improvement over ASM. Rust is just retarded with it's forced security.
>>
>>59578021
What DOESNT use some concurrency in the current year? Rust is an entirely new paradigm, beyond the basic security upgrades it's going to require CBabbies to do a lot more thinking than an ASM->C change.
>>
>>59577357
But really this is the CORRECT implementation of const correctness. It's objectively the best possible implementation of this concept and it's objectively a net good.
>>
>>59576727
It compiles statically by default. Use -C prefer-static and it's down to the same size as the C hello world.
>>
>>59578077
>it's going to require CBabbies to do a lot more thinking than an ASM->C change.
Yeah, it's gonna require a lot more "considering non-programmer" problems to achieve the same result as simply using C.
>>
>>59577586
I work with an asshole that just loves to overengineer everything and rely on the mother of all mutability antipatterns. It's literally impossible to tell what the fuck is going on when errors happen. Every single one of his commits have a dozen extra errors because he never tests shit and the unit tests don't catch shit because of the state requirements that he himself doesn't even understand.

TL;DR: FUCK MUTABILITY. It should be used to simplify functional algorithms, not the other way around.
>>
>>59578137
It's software design problems, if you're not capable of thinking about that then you're a shit programmer anyway. As for just getting shit done with no thought to safety or concurrency yes that would probly be a better job for C. Or random dynamic typed scripting language.
>>
>>59577811
Rust has no runtime. It also compiles to machine code via assembly.
>>
>>59578121
-C prefer-dynamic of course.
>>
>>59577707
What the fuck does bare metal even mean? If you can process optimize well enough on a good machine and produce viable content then who the fuck cares what you write it in, its your choice.
>>
>>59578198
There's a lot of domains where that is not true.
>>
Honestly, because of all the muh sjw shit going around with rust, I had done my best to avoid it. Even started working on my own programming language (I have a barely working prototype). Then it turned out that rust implemented almost all my ideas already so I tried it out and it was glorious.

The only things I feel it misses are:
- a real interpreter, including with runtime hotpatching and debugging support (as in lisp languages)
- full dependent types
The only concept I think should be explored as an alternative to what rust does is:
- call-time borrow checking (as opposed to the current define-time borrow checking).

Honestly, I can completely do without these features though I'd be overjoyed to see them land. All in all, rust is the best language I've ever used.
>>
>>59578445
Regardless, rust is as bare-metal as C.
>>
>>59578463
Sure, did you see there's a rust microcontroller OS now too?
> https://www.tockos.org/

Of course all of these things require using the NIGHTLY branch of Rust so that's not actually the language yet. Sorry, Rust is too immature for anything good. All beta/experimental for now.
Soon.
>>
>>59578492
Yeah, rust definitely needs to continue to mature. I don't think they should have called the 1.0 version a 1.0 version.
>>
>>59578492
I wonder what Tock uses from nightly, but surely they will stabilize it at some point.

Rust is still pretty much in its infancy though, you're right about that. Still seems to have more traction than any of the previous sepples killers, and that's good.
>>
>>59578454
Cancer pink-haired SJWs left. Mostly because nobody was paying attention to them.

Look around in the big repos like Servo or Rayon. They are full people working, no stupid SJWs no angry alt-righters on Twitter. Just people working.
>>
>>59578537
To customize the memory alocator you need to use nightly. Stable requires jemalloc. Most projects aren't going to want that.
>>
>>59578537
I'm guessing it's using the improved support for libcore components.
>>
>>59578551
At least jemalloc on linux, I bet bsd doesn't use that but I'm really not familiar with that. There's probly other stuff too.
>>
>>59578541
Thank god, that's what I loved (and still do) about the C++ community, systems programmers are usually no bullshit, results oriented people.

I've worked with many people whom I massively disagree with politically in the field and so far we've kept it very professional and i appreciated working with them. Hopefully I'll never have to deal with the likes of the shitfights i've seen in the Ruby community.
>>
File: joke-to-be-over_systemd.png (494KB, 960x949px) Image search: [Google]
joke-to-be-over_systemd.png
494KB, 960x949px
bump
>>
>>59576529
Ugliest syntax I've ever seen.
>>
>>59579370
It's mostly the same as D/C++ though, except where new concepts are involved. Are you coming at the syntax from something like python where you wouldn't know any of this anyway?
>>
>>59579378
Coming from C/C++ I find it a lot more difficult to read
>>
>>59579395
Excepting lifetimes it's pretty similar all around. A bit of sugar with funcdefs but that's more readable if arbitrarily different.
>>
>>59579370
What would you change?
Moreover, what do you consider good syntax?
>>
>>59579395
It's literally an easier to read C++ syntax. You're full of shit.
>>
>>59579395
Well, sure. They are not the same, but that's something you don't like because of your background, not an objective flaw of the language.

If anything Rust syntax has a lot less caveats and is leaner than C++'s (for once all modifiers go to the left and all type annotations go to the right)
>>
>>59579406

Looking at the examples of rayon since that was mentioned
https://github.com/nikomatsakis/rayon/blob/master/rayon-demo/src/quicksort/mod.rs#L69
What's up with the PartialOrd+Send in the type def? Is that + an operator to denote multiple possible types?
>>
Shilled by total retards.
Oh wait that's a feature.
>>
>>59579950
That's a trait, it means that any class that is ordered must have implemented PartialOrd, which iirc requires some partial_eq or something for specific partially mutable sorting.
>>
>>59579950
It means both traits must be implemented for the type that is passed.
>>
>>59578077
most of the thinking one does in Rust is trying to remember the names of the 4000 libraries you need to do anything

shit has the taint of web dev upon it
>>
Ugly as shit
Written by psychopaths (SJWs), run by said psychopaths: Code of conduct
Retarded every-and-the-kitchen sink "crate" system
Generic programming interface sucks balls
Basically C++ for retards

>>59576619
>most of the sjw's left. Rust is mostly full of russian (for better or worst)
The moment Rust gains the market's attention they will return, so best leave it buried. SJWs are too intimidated by the C++ language to even think about infiltrating.
>>
>>59580287
No? Not even that many libs around, lots of bindings to other languages translated into SAFENESS possible though.
>>
>>59580339
>Generic programming interface sucks balls
The rest of your post is bait without substance, but this is just plain wrong.
Rust's genericity facilities are great, and though you can't do the turing complete magic tricks of C++, it's basically the only one on the market that even comes close.

You could even argue that they are better because Rust actually has Traits when C++ Concepts are still a planned feature.
>>
>>59578454
>>59578541
>Trying to do damage control for the SJWs
It's not going to work, we know they're still around.

I'm sure a shitposter on 4chan is a genius architect whose ideas were implemented by rust.
>>
>>59580287
Bullshit, there are like a couple essentials for specific domains, like tokio for networking/io, rayon for paralelism, diesel for database work, serde for serialization and so on.
>>
>>59580418
>You could even argue that they are better because Rust actually has Traits when C++ Concepts are still a planned feature.
Yeah but Rust implements traits in the least flexible way possible for "muh safety".

I know it's trying to be like C++ but the Turing-completeness really is a feature and once concepts arrive (and they will arrive by 2020) C++ templates will be unbeatable.

The reason why it's taking so long is because it's a hard problem and C++ standards have to get it right first time, they don't have the luxury of obscurity like Rust.
>>
>>59580439
Serde is so shit compared to rustc-serialize in terms of ease of use, though. Will this be fix some day?
>>
>>59580287
>most of the thinking one does in Rust is trying to remember the names of the 4000 libraries you need to do anything
It's exactly webdev culture.

>>59580439
>tokio for networking/io, rayon for paralelism, diesel for database work, serde for serialization
Just from the names you know that the people who designed this system aren't really system engineers because they would have chosen names that make sense without having to remember some fancy gay sounding shit.
>>
>>59580420
Go be clinically retarded somewhere else please. Like in the go thread. Get it? Go? Go thread? Go there.
>>
It doesn't have big community
>>
>>59580490
It has a bigger community than anything that's not python, C++ or java at least.
>>
>>59580473
>implying engineers don't give retarded names to everything constantly
Yeah 'cause Linux, SDL, OpenGL, Vulkan and so on are not exactly as tacky...

Besides, if you dismiss shit because it's not named properly I don't really want to work with you, you're basically as annoying as an SJW.
>>
File: 1485953294808.jpg (114KB, 471x550px) Image search: [Google]
1485953294808.jpg
114KB, 471x550px
>>59580486
>opposing SJWs means you're clinically retarded
Look how about you actually prove your statement that the SJWs left?

Did they take their CoC with them?

>>59580486
>Get it? Go? Go thread? Go there
Oh great pun codefriend, +1 upboat, I know another place you could go [back] to. You might find more idiots you can convince there than here.
>>
>>59580420
Can someone post the NASA /g/entooman photo again for this newfriend?
>>
>>59580527
>OpenGL
>Open
>Graphics
>Library
>the name space is "gl", graphics library
>comparable to "sarde"
You're kidding right? Please tell me you're kidding.
>>
>>59580460
There are codegolfs going around to create the longest, most obscure errors and, surprise, surprise, the top answers use C++ templates.

When a language has been around for long enough, it needs to keep the crud on it for backwards compatibility. This is why JavaScript/ECMAscript and PHP have so many terrible flaws. If they get rid of them, it will break code.

"Meme" languages like Rust and Go freshen things up not only to remove the crud, but also solve certain paradigms (Rust for parallelism/safety, Go for large projects).

>>59580287
Same as any other language.
>>
>>59580581
<Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.
>>
File: shig.png (128B, 125x125px) Image search: [Google]
shig.png
128B, 125x125px
>>59580581
>I don't get the name
>therefore it's terribly named
>>
File: anti-sjws-are-the-sjws.jpg (248KB, 1280x1109px) Image search: [Google]
anti-sjws-are-the-sjws.jpg
248KB, 1280x1109px
>>59580550
>newfriend
>-friend
Ironically your lexicon and not having image searching (and storing, sorting) skills gives away your original

>>59580527
>you're basically as annoying as an SJW
Pic related is not quite what you're saying but very much the same spirit of it. You Rustfaggots don't take criticism well.

Your namespace is shit, your language is ugly. Get together and standardise, try to keep your static binaries under 100GB. Hire some professionals instead of using Firefux's webdevs.
>>
>>59580588
Go for pajeet projects
FTFY
>>
>>59580616
SJWs like you belong on >>>/tumblr/
>>
>>59580616
>canned response that doesn't even address the point
>>
>>59580537
The CoC is still big on the main page. But in practice it doesn't really matter.

Thing is Rust is complex language and it's not as accessible as, for example, Ruby, so it's harder to liberal idiots that can't code to meddle with it.

Also if the Rust core team starts fucking with developers because they say X, Y or Z on twitter we can just fork it. Happen with Node with io.js and in the end developers won.
>>
>>59580616
Go away SJW.
>>
>>59580649
>Happen with Node with io.js
Really? Source?
>>
>>59580614
>>59580598
Alright then, I'll look aside how asinine it is to call a serialisation library serde, how about "diesel"?

>>59580588
>When a language has been around for long enough, it needs to keep the crud on it for backwards compatibility
You haven't heard of C++'s depreciation system have you?

initial standard announces depreciation
follow up standard actually does the depreciation

C++'s committee is not afraid to break backwards compatibility, most compilers support any C++ standard through -std=c++xy
>>
>>59580666
>C++'s committee is not afraid to break backwards compatibility
Satan stop lying, even Bjarne admits this is not true.
>>
>>59580649
>Happen with Node with io.js and in the end developers won.
More on this please.

As long as the CoC stays erected on the front page I can't take Rust seriously.
>>
>>59580666
> C++'s deprecation system.
Oh good, that's a rel-

>>59580681
Damn it.
>>
>>59580683
>As long as the CoC stays erected on the front page I can't take Rust seriously.
Only you end up losing in that case. Do what you want.
>>
>>59580698
No it is true, ignore the Rustposter

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0174r0.html

>A number of features of the C++ Standard library have been surpassed by additions over the years, or we have learned do not serve their intended purpose as well as originally expected. This paper proposed deprecating features where better, simpler, or clearer options are available.
>>
>>59576529
>Name one flaw with Rust that isn't actually a feature.
It's not C#
>>
>>59580666
In practice the deprecation is very rarely used, it happened to throw() and other stuff, but the commitee is very meek on deprecating stuff.
>>
>>59580662
You can search that for yourself.

Short story: The Node.js core team was full pricks who where very picky with who they let to contribute. Developers got pissed and forked Node into io.js. io.js started btfo of node in terms of performance. The node team got scared and agreed to disband their stupid prick circle system and merged with io.js

Today Node's government system is that of io.js and not their original monolithic one.

If the Rust core team starts rejecting developers contributions because they don't agree with their CoC we can always fork it.
>>
>>59580728
That's the mother of all features lad.
>>
>>59580722
>what the comitee wants to do lines up with what they actually do
I wish. We'd have concepts and modules by now if that were true.
>>
>>59580728
kys
>>
File: anime1.png (306KB, 593x540px) Image search: [Google]
anime1.png
306KB, 593x540px
>>59580780
> we can always fork it

And people say open source doesn't work
>>
>>59580785
It takes a while to get it right but it does get there eventually.

E.g, C++17 now supports multiple assignments:

[x, y] = multi_return();
>>
>>59578492
>All beta/experimental for now.
>Soon.
Rust is the AMD of languages
>>
>>59580879
You need auto in front of that statement iirc.

I will give credit to the comitee that eventually they make the right choices, C++ wouldn't have lasted that long without.

But saying that they don't keep crud in because once in a blue moon they deprecate some things is pushing it.
>>
>>59580780
>If the Rust core team starts rejecting developers contributions because they don't agree with their CoC we can always fork it.
Nah that won't happen, you just know you'll keep taking the CoC.

>We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity
>We will exclude you from interaction if you insult, demean, or harass anyone

>Adapted from the Node.js Policy on Trolling
Rust is C++ by webdevs

>>59580925
>You need auto in front of that statement iirc.
Only if the variables haven't had their types defined earlier but its the favoured use case to use auto in this context.

Or if you want the type to be converted:

pair<int, string> [x,y] = blah();
>>
>>59580973
Rust is C++ developed FOR webdevs/pajeets who would otherwise blow shit up. Like golang is C for pajeets only better.
>>
>>59580991
>i never had to deal with a complex race condition in a nontrivial application
If you weren't a LARPer I'd ask you what your technical grievances with Rust are, but I bet you just have sour grapes because you can't get past the compiler errors.
>>
>>59581040
>I don't know how to use system locks and critical sections in C++
>>
>>59581040
That was actually a pro-Rust comment. I can rely on rust libraries to be safe enough to use. Always gotta keep the worst programmers in mind which is why C is unacceptable.
>>
>>59581057
You know people who do concurrent programming don't just throw a mutex at every problem right? We can't use the canned lock guards because we need to leverage performance, not parallelize some easily splittable task.
>>
>>59581070
Misread that as sarcasm. Sorry.

You're still wrong though. There's no way pajeets would gravitate towards a language where the compiler yells at them when they make subpar code.
Go is where all the Java enterprise bullshit will go I bet.
>>
>>59581139
Then it's suitable for an excellent coder on a very bad day.
>>
>>59577357
kek
>>
https://github.com/rust-lang/rust/pull/25640

Arguing about pronouns in an example problem.
>>
>>59582056
>Random webshit tries to be important, gets shut down
>>
>>59577586
>mutable variables
>variables
>variable

How does English work?
>>
>>59582220
The original mathematical definition of "variable" doesn't imply something is mutable inside the function it's used in.
>>
>>59582220
Mutable is correct. A "const variable" is incorrect but it's really a binding so no biggy.
>>
>>59582220
What do you not get?
It's something that can change value but that you, personally, do not have the right to change. As opposed to constants which are always the same value.
>>
>>59578492
> all those functions marked unsafe
> yep rust sure is an improvement over c
>>
>>59582468
Unsafe code isn't necessarily unsafe to the rest of the program though. Nobody argues that you can't make safe C code, just that you have to be really fucking careful. Unsafe blocks are just that.
>>
>>59582220
They are called variables because they can't be assigned to anything.

That's their definition in logic.
>>
>>59577586
>"Mutability is something you have to use only when you are sure you need it, not the other way around."
Wait, so it's something you have to use only when you're sure you need it, but NOT something you're sure you need only when you have to use it?

So you can be sure you need it in situations where you DON'T have to use it? What??
>>
File: .gif (923KB, 450x259px) Image search: [Google]
.gif
923KB, 450x259px
>>59582905
>t. brainlet
>>
File: 1468921207181.png (183KB, 423x254px) Image search: [Google]
1468921207181.png
183KB, 423x254px
Ok.

10.pow(2); // error: no method named `pow` found for type `{integer}` in the current scope
10i32.pow(2); // Works


I know why the top one doesn't work, but I'm pretty sure I heard that integer literals default to i32, so why couldn't the compiler find the right implementation of pow for it? Seems like a bug to me.

Other than that, don't get me wrong, I like Rust.
>>
>>59583006
I

uh

Okay you got me.
>>
>>59577707
Are you retarded?
Rust is a compiled bare metal language like C and C++.
You can write freestanding rust code just like you can write freestanding C or C++ code.
Kill yourself.
>>
>>59577811
C does have a runtime and rusts runtime is comparable to C's.
>>
File: 1486412694908.gif (2MB, 300x300px) Image search: [Google]
1486412694908.gif
2MB, 300x300px
>>59582905
Okay, lets see:

"Mutability is something you have to use only when you are sure you need it"

That is to say:

You use mutability, then you are sure you need it.

Thus, you can be sure you need it but not use it.
So yes, you can be sure you need it and not use it.

But I don't think that's what anon meant...
>>
>>59583189
No, anon said HAVE TO, thus the statement is and if and only if.

You use mutability if and only if you are sure you need it.
>>
>>59578097
>>59577357
>not using #define C pre processor commands for constants
Especially shit since Rust isn't even garbage collected.
>>
>>59583914
>optimizing around preprocessor gibberish
>>
>>59576529
Low usage? Crappy readability and forced and so called secure style that makes your program unstable as fuck?
>>
>>59583977
It's stylistically preferred in C
Before C99 it was required since const wasn't constant.
In C++ sure use const
>>
>>59576529
The std is built on libc
>>
>>59583997
>It's stylistically preferred in C
>Before C99 it was required since const wasn't constant.
With a reasonably good compiler static const has a similar effect for optimized builds but inserts names for debugging.
I don't think there's any reason in modern days to use defines for constants outside of using it in CPP decisions.
>>
>>59584024
This sort of mentality that "the compiler is smart, just rely on it!" is very bad practice
>>
Rust is awesome. Safe, fast, expressive, easy interop with C (both Rust -> C and C -> Rust, so you can write Rust code that can get called from C). It's a great replacement for C and C++ and maybe even some more higher level languages like Python.

I just wish it had better tooling. By that I mean debugger support with runtime expression evaluation and especially better auto-completion. I don't want to open the documentation for everything when I don't remember the name of some method or what arguments it takes. In other languages like C, C++, Java, Lisp, etc I can "explore" this on the fly and get shit done faster.
>>
>>59579959
Kek
>>
>>59584051
>This sort of mentality that "the compiler is smart, just rely on it!" is very bad practice
If you don't want to rely on your compiler to be smart you will start doing hacks like
 x << 2 
instead of
 x / 4 
again.
There's a baseline of things to be expected of a compiler, especially around a desktop setting.

If you have a special compiler for some reason (military certified, weird platform) then it may make sense to hand-optimize like that, but then you should know your compiler and what it can and can't do.
>>
>>59584088
What tools do you use?

I get very good auto-completion with the VS Code extension.
>>
Has anyone used Rust Language Server? Is it better than racer?
>>
>>59584426
Bit level hacking is the best. How do you expect to rival genius if you don't do that?
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;

x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed

return y;
}
>>
>>59584593
The Gnome builder team uses it for Rust linting. It's a little bit green ATM.
>>
>>59584426
Plus I must emphasize, why would I expect a compiler to do something with code that I didn't tell it to do?
If I create a variable, it better create a variable.
Having the computer do something I don't tell it to do is obviously bad.
Now obviously if you use a flag like -Ofast that breaks standards compliance, sure maybe then the compiler should do something you didn't tell it to explicitly do.
>>
>>59584961
Why are you even using a compiler at all then?
>>
>>59584961
> If I create a variable, it better create a variable.
<optimized-out>
> -Ofast that breaks standards compliance
Standard has nothing to say about creating every variable you declared, and -Ofast doesn't break the compliance. If anything, it makes the compiler more standard-complaint by using every UB possible.
>>
>>59583006
You should ask about it on the rust irc and see what they have to say about it.
>>
>>59583093
Neither have a runtime. That's one of the major disadvantages of C++ (which odes have a runtime).
>>
>>59583914
But that's inconsistent with the language and also doesn't allow dynamically setting immutable variables so no, you're completely wrong.
>>
>>59576597
Is Social Injustice any better tho?
>>
>>59579501
lisp
>>
>>59586625
Common Lisp is the only legitimate Lisp.
>>
>>59586674
Odd way to spell scheme.
>>
>>59586617
False dichotomy.
>>
File: 1.png (7KB, 722x164px) Image search: [Google]
1.png
7KB, 722x164px
>>59577284
Let's see how the best language created by god deals with it.
>>
>>59586714
>Spotty SRFI support across compilers
>hygienic macros shit up the language with multiple macro definition constructs
>lisp-1
>(car '()) is an error
>call/cc makes unwind-protect and friends a mess to define
>no common data structures like hash tables in the language
>no read-time evaluation
>no read macros
>>
>>59586815
>literally too dumb to know the difference between an implementation and a dialect
>also doesn't actually know shit about any implementation but still talks shit
Common lisponies everybody!
>>
>>59586850
Everything that I have mentioned is applicable to Scheme. What you are saying just emphasizes the disparity between implementations.
>>
>>59586728
It's really an either-or proposition. It may be the devil or it may be the lord, but in the end you will have to serve *somebody*.
>>
>>59587095
I am my own god. I serve only myself.
>>
>>59587095
t. inbred
>>
File: e79.png (138KB, 364x360px) Image search: [Google]
e79.png
138KB, 364x360px
>>59587115
>>
#include <stddef.h>
#include <stdio.h>
#define print_sizeof(type) printf("size of " #type " on this machine is %d\n", sizeof(type))
int main() {
print_sizeof(char);
print_sizeof(short);
print_sizeof(int);
print_sizeof(long);
print_sizeof(long long);
print_sizeof(size_t);
print_sizeof(float);
print_sizeof(double);
print_sizeof(void*);
print_sizeof(void(*)(void));
return 0;
}
>>
>>59576727
people who compare hello world sizes are the same people who "benchmark" languages by timing a for loop that only increments a value.
theyre idiots.
>>
>>59589306
Doesn't matter, the difference is that rust does static compilation by default while C does dynamic. Use dynamic for rust and it's within 10% of the C size. Use static for C and suddenly rust is smaller than C.
>>
>>59589249
>sizeof char
Jesus fuck these rust shitters will be the death to us all.
>>
>>59589306
It's valid for cases where you want to develop mobile app for example and wonder should you use kivy, qt or something.
>>
>>59589715
that's c you retard
>>
>>59589838
C programmer wouldn't write such code, especially in fucking rust thread you retarded faggot.
>>
>>59589913
1) I am a C programmer
2) I would indeed write such C code if I needed to know the sizes of various integer types on my computer and didn't feel like looking it up
3) I would indeed write it in a rust thread because that would constitute shitposting which is my favorite thing to do
4) it's fucking C, if you don't believe me plug it into any compiler you have
>>
>>59589987
Go have your circlejerks in >>>/reddit/
faggot
>>
>>59590021
Thanks for demonstrating: can't spell cuck without C.
>>
>>59590021
>1) I am a C programmer
>2) I would indeed write such C code if I needed to know the sizes of various integer types on my computer and didn't feel like looking it up
>3) I would indeed write it in a rust thread because that would constitute shitposting which is my favorite thing to do
>4) it's fucking C, if you don't believe me plug it into any compiler you have
>>
File: 2.png (24KB, 142x132px) Image search: [Google]
2.png
24KB, 142x132px
>>59590062
>he unironically uses the word cuck
>>
>>59586596
Obviously it is inconsistent with Rust. It is an obvious example as to why C > Rust, C++
Just goes to show Rust has poor design choices, and likes to be "safe" while still allowing for potential memory leakage by dealing with constants in a stupid manner.
Of course they won't implement garbage collection to truly make their language safe, that would slow it down!
>>
>>59590381
>rust
>memory leakage
>macros are consistent with C
Do you have down's syndrome or were you merely lobotomized?
>>
>>59590478
Rust shills don't even have arguments! Sad!
>>
>>59586596
you can dynamically set immutables
let x;
...
x = foo();
>>
>>59590518
u wot m8?
>>
>>59576529
So you saying Rust is designed as flawed on purpose. Oh well.
>>
>>59590478
Rust does leak memory. Go to Mozilla IRC and ask them if leaking memory is safe. They'll say yes.
>>
>>59592850
Do you have down's syndrome or were you merely lobotomized?
>>
File: maxresdefault.jpg (44KB, 1280x720px) Image search: [Google]
maxresdefault.jpg
44KB, 1280x720px
>>59592850
>lying this blatently
>>
>>59592954
Rust leaks memory.
>>
>>59592985
Prove it.
>>
>>59577479
I don't even wanna be able to edit variables, which is what makes Haskell so much safer. If x = 10 then x should forever be 10. I don't want to have to worry about that. This also makes parallel programming so much easier/safer.
>>
>>59592985
[citation needed]
>>
>>59592954
>>59593004
You literally have no clue what you are shilling then, expected from people shilling Rust so hard. Memory efficiency is orthogonal to memory safety.
>>
>>59593126
Rust does not leak memory at any time. What it does is effectively insert malloc() automatically. Due to the way region-based memory analysis work, this is infallible. Kill yourself any time.
>>
>>59593213
You're absolutely ignorant. You'll even get examples about it in issues on the GitHub repo.
>>
>>59593250
[citation needed]
>>
>>59593324
Google it yourself.
>>
>>59593340
>no source
>no citation
>"j-just google it"
>literally nothing comes up on google
>even logic disagrees with you
>still can't provide any hint of evidence of any kind
really makes you think huh. I wonder who is behind that post.
>>
>>59593382
>I wonder who is behind that post.
Just normal people with a real job, unlike you!
>>
>>59593382
RAII never prevented leaking. Also even forget is considered safe. You'd know that if you actually tried learning the language, you'd also have realized it's pretty much worthless in its current form.
http://lmgtfy.com/?q=rust+lang+memory+leak
Now proceed to kill yourself, shill.
>>
>>59593447
You should peruse your own link but I wouldn't advise it. After all, it would BTFO you to the point of suicide, guaranteed.
>>
>>59593476
>look mom I'm trolling on 4chan XD
>>
>>59593447
Produce a safe Rust program that leaks memory or fuck off anon.
>>
>>59593513
When was your lobotomy? Was it recent or rather old?
>>
>>59593516
Don't even have to actually provide an example.
>forget is considered safe
https://doc.rust-lang.org/std/mem/fn.forget.html
Did you guys even try learning the language you're memeing?
>>
>>59593546
>implying purposeful ressource leakage is what people refer to when they talk about memory leaks
You're stretching it. But you're technically right if you use a broad definition of leakage.

That's definitely argueing in bad faith tho, you sly fuck.
>>
>>59593546
Thanks for proving your knowledge of anything that exists is colder than absolute 0.
>>
>>59593673
>asks to produce a safe program that leaks memory
>gives an absolute example of how to do it
>b-but bad faith!
>>
>>59593673
There are situations in Rust's problem domain (low level programming) where you will not want to have RAII release your resource. In C++ people tend to artificially extend the object's lifetime by storing a reference somewhere, this is Rust's idiomatic and less dumb way to do it. It's actually pretty good. But it's still able to leak memory.
>>
File: You are wrong.jpg (208KB, 1000x667px) Image search: [Google]
You are wrong.jpg
208KB, 1000x667px
>>59593783
>Rust's problem domain (low level programming)
>>
>>59595280
How does it feel to be dumber than garden-variety rocks?
>>
Rust is for ____
>>
>>59597722
Everything lovely.
>>
>>59597722
Systems programming.
>>
Awful syntax and made by sjw's.
>>
>>59598637
>Awful syntax
How?
>>
>>59597722
People that are serious about memory safety.
>>
Notice how there's no C or C++ threads on the catalog?

Wanna know why?

Because people who use those languages are too busy ACTUALLY HAVING A JOB.
>>
>>59597722
writing IoT privilege checkers
>>
>>59598765
>Notice how there's no C or C++ threads on the catalog?
really?
>>
>>59598765
see >>59584739
>>
>>59598765
Lmao! More like too busy looking for a job!
>>
>>59576727
3.4MB for me
>>
>>59582220
Well actually in rust they're called variable bindings, in the sense that you're just creating a name for some kind of data. Bindings can be mutable or immutable, which affects whether or not you can use them to alter the data they are associated with.
>>
Why I can't take Rust seriously. Maybe I'm too old for this.
https://github.com/rust-lang/rust-www/issues/268
>>
>>59576529
HN won't shut the fuck up about it, which means it's cancer and should be treated the same as all the fucking JS frameworks that are shilled there.
>>
>>59599173
Yeah but unrelated to actual code, that's just mozilla webdev shit.
>>
>>59599173
>Maybe I'm too old for this
You are not and that's why you care about it
>>
How does String::from("string"); make sense
>>
File: Girls.png (490KB, 449x401px) Image search: [Google]
Girls.png
490KB, 449x401px
>>59577357
> special keyword for mutable variables
> defending it
>>
File: Nicolas-Cage-Laughing.png (337KB, 640x348px) Image search: [Google]
Nicolas-Cage-Laughing.png
337KB, 640x348px
>>59593783
> Rust's problem domain
> low level programming
>>
>>59600727
>trusting mutable-by-default data
>>59600741
It's not false but it's not the whole story either.
>>
>>59583078
> Rust
> "bare metal language"
> safe wappers around C libraries
> runtime checks for array overruns
>>
File: wn20121130a4a.jpg (906KB, 3224x1920px) Image search: [Google]
wn20121130a4a.jpg
906KB, 3224x1920px
>>59600752
> assuming everyone is a pajeet programmer like yourself
>>
>>59600771
You don't seem to know what bare metal means
>>
>>59600790
>assuming anyone isn't pajeet/drunk/retarded some portion of the time
>>
How fast is Rust compared to Python?

How long would a rust program take to calculate the sum of all prime numbers upto 2000000?
>>
>>59600823
not accounting for coder error, probly much much faster. It might take a while to compile vs. interpreting though.
>>
>>59600741
>>59600752
It is very unfit for anything else
>>
>>59601288
Like C++ it's a whole-stack kind of thing, keeping a low level optimized codebase while transitioning the data up to higher level software. It's not assembly and it's not python, it's just sort of the whole range in between. Doesn't mean you should always need to have the same level of safety and code structures through every level but that's the sort of thing C++ is for and Rust is trying to kill C++.
>>
File: 1446015380750.jpg (7KB, 200x200px) Image search: [Google]
1446015380750.jpg
7KB, 200x200px
>>59576529
hipster meme language
>>
>>59586584
If C++ has a runtime and rust doesn't, then why does it require more effort to get Rust code executing in kernel mode than C++ code?
>>
>>59599085
11kb for me
>>
>>59600823
Rust is faster than C++, almost as fast as C.
>>
>>59602398
Because you are clinically retarded. Other people do not have that problem.
>>
>>59590478
>>59592954
>>59593543
>being this autistic about lobotomies
Oh I get it now. You're projecting.
Look I'm sorry about your lobotomy anon, but don't be autistic and take it out on other people.
>>
>>59602782
It's no longer possible to tell if the people saying this are shitposting or if they actually believe it
>>
File: 1490213164540.png (216KB, 1712x944px) Image search: [Google]
1490213164540.png
216KB, 1712x944px
>>59605048
>>
>>59605067
>the same tired old doctored graph as always
Please find some new shitposting material.
>>
>>59605088
Nice argument anon
https://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest.html
>>
>>59605102
Carefully written Rust can sometimes catch up to lazily written, unoptimized C. The same is true of Go and Java, but they're still not fast languages in general.
By the way, those benchmarks have frequent rule changes specifically intended to make Rust look better than it really is.
>>
>>59605150
So what's your point?
>>
>>59605150
>unoptimized C
It's not
>>
>>59605157
Those "benchmarks" aren't an argument and their Rust results aren't representative of Rust performance in the wild.
>>
>>59605170
So why were you benchmarking back in >>59600823

>I'm not him
So why the fuck did you reply to >>59602782 ?
>>
>>59605170
Neither is C
>>
>>59605186
>So why the fuck did you reply
Programmers have a duty to tell the truth.
>>
>>59605206
You didn't tell any truth, you are just posting your shitty opinion.
>>
>>59605170
I don't need a benchamrk to say Rust, C and C++ have the same level of performance. It's just you who are too much deep in denial of the fact that Rust is catching up
>>
>>59605246
who are in*
>>
just a question that doesn't have anything to do with the matter at hand:

Are most of you IT students / visiting a university?
I want to get into IT but I have to decide whether to go to University or doing vocational training and working for a local company.
Is
>>
>>59605710
I'm a physics major and a Rust shill (tm)
>>
>>59576727
Shitty for normie apps
Great for servers since wtf it's 12mb

>>59577647
It's more efficient to put something as a Const than as a variable in terms of the compiled executable

as data can be stored in the data section instead of code or some shit like that

>>59577687
you have to cut 90% of it's features
>>
>>59605088
What exactly makes you not believe that benchmark? Do you think C++ is perfect or something?

Rust is far less abstracted than C++, it is obviously going to be more performant as a result. The fact that C++ lasted so long without being shit on by something better is what is most surprising here. If Rust didn't beat C++, some other language would have done it eventually, C++ is not some divine language destined to be the closest in performance to C forever.
>>
Compile times. I liked the emphasis on code format, documentation, and testing that most toolchains will leave to 3rd party programs.

Obviously maturity, stability, libraries as with any new programming language but there are people who will still state the obvious...
>>
I don't like the fn keyword.
>>
>>59602791
If you try to compile rust code for running in kernel mode, you get thousands of linker errors for missing basic operations and the only way to fix it is by passing --gc-sections to the linker which gets rid of sections you don't want to get rid of.
>>
>>59609609
Please be bait. I refuse to believe people this retarded exist.
>>
>>59605170
True. Rust in the wild is faster than C. See ripgrep, leaf, collenchyma, xml parser, and more.
>>
>>59609643
I think you're the only retarded one here.
How do you do it then?
>>
>>59606514
>Rust is far less abstracted than C++, it is obviously going to be more performant
>abstractions make program more performant because compiler can reason better about what you're trying to do
>rust is faster than Cpp (which can output the same machine code than C) because it is less abstracted
Will /g/ ever make up its mind?
>>
>>59605710
>IT
>university
My sides!
>>
>>59609653
Don't forget Servo which thoroughly BTFO's every other browser engine.
>>
>>59609663
You're confusing two concepts here: closeness-to-metal and conceptual burden. Both are called 'abstraction' and the context disambiguate which one is meant.
>>
>>59609663
>Will /g/ ever make up its mind?
Have you ever considered the fact that /g/ isn't one single person you braindead moron?
>>
>>59609643
It's true though. If you use freestanding and remove the unused section's that's how you build kernel mode programs. Check out some rust x64 kernel tutorial, I don't remember the name but you can find it easily on Google.
>>
>>59606311
>debunked
>true
>false
>>
>>59609683
gc-sections isn't necessary anymore, and having to add a single flag does not make it harder to use than c++ for kernel dev (in particular, C++ needs 2 flags instead of 1 and also requires redefining several basic functions, including new/delete/[]), nor does it mean it has a runtime or that c++ doesn't have a runtime.
>>
>>59580527
You do realise Linus didn't actually want to name it Linux?
>>
>>59584705
well processors have an instruction for this now, so doing it by hand is extremely slow, but yeah, bithacks are the best
>>
>>59609808
>gc-sections isn't necessary anymore
Ok the how do you do it nowadays?

>And having to add a single flag [..]
It's a flag that fucks up your kernel image and removes sections that are required for the kernel to boot
>>
>>59610100
b8/8 m8
>>
>>59610145
Nice argument, you sure convinced me.
If you think you can successfully win an argument by pretending to be retarded you'd be very wrong.
>>
>>59610219
>If you think you can successfully win an argument by pretending to be retarded you'd be very wrong.
Then why do you keep trying this strategy despite being called out multiple times?
>>
>>59610311
I've never been called out though
If anything, people are agreeing with me (>>59609683).
Autistic screeching doesn't count as "calling someone out"
My claim is that you need to use gc-sections in order to build a kernel mode binary which appears to be true in my experience, and you have not provided a single argument that shows otherwise.
Please, if you're so smart, then tell us how do you build a rust kernel without getting a million linker errors like when doing the same thing in either C or C++.
I'm waiting.
>>
>>59610410
gr8 b8 m8 I r8 it 8/8
>>
>>59610488
No argument then. Ok.
So I win.
>>
>>59610510
I accept your surrender.
>>
>>59610530
I see you have a mental problem
>>
>>59610530
>>59610488
>>59610311
>>59610145
>>59609643
>These are the kind of people who use rust
I feel ashamed for learning rust now
>>
>>59610786
Your tears are delicious. Please keep posting.
>>
>>59610822
Do you actually think you won that argument or something?
You provided literally zero arguments.
>>
>>59582239
Fact. It's just called that because what a variable value is cannot be known until it's defined.
>>
Eh Rust is nice I guess. But I will wait until it reaches v2.x
>>
>>59602398
i dunno maybe the toolchain is worse? when did 1 vs 2 vs 3 extra compiler flags become relevant to anything?
>>
>>59610868
>oh no I lost again!
>i-if I proclaim I win while i-ignoring all arguments, h-he won't notice my tears!
Yum yum!
>>
>>59610943
That would imply that it's not harder to get C++ code executing in kernel mode, which is incorrect, however.
>>
>>59610969
But it IS easier to get C++ running in kernel mode
>>
>>59611457
>have to use 2 flags and rewrite memory-related functions
>easier than using 1 flag
>>
>>59611478
m8 you have to write memory allocation functions regardless if you're writing in C or C++. It literally doesn't make a difference.

If you don't need to allocate memory then you don't need to use or redefine new
>>
>>59611605
I don't mean the OS-level memory allocation functions, I mean the language-level memory allocation primitives. Those in C++ are supported only by the runtime, which is not supported in kernel mode which is why you have to rewrite them (typically you just map them to the C primitives instead).
>>
>>59611622
Rewriting those primitives is usually just a few one line functions that call your OS functions.
It's not really that much of an inconvenience compared to passing gc-sections to the linker in order to get rust working in kernel mode.
>>
>>59611697
It's a significant inconvenience by comparison.
>>
>>59611728
How is a broken kernel that doesn't even boot a lesser inconvenience than having to define a few simple one line functions?

Remember that rust also requires you to define a few functions to support its runtime.
>>
>>59611791
It isn't broken and boots just fine. PEBCAK. And that's without even getting into the massive hole in your argument that it is the "only way" about it when it's not even the preferred way.
>>
>>59611854
Alright then what's the preferred way?
>>
>>59611904
compiler-intrinsics
>>
>>59611959
Link?
I didn't find anything about it when I looked up how to get rust running in kernel mode.
>>
>>59612162
http://os.phil-opp.com/multiboot-kernel.html
>>
>>59612162
https://github.com/rust-lang-nursery/compiler-builtins
Thread posts: 324
Thread images: 26


[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.