[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: 46
Thread images: 4

File: rust.jpg (35KB, 1680x1260px) Image search: [Google]
rust.jpg
35KB, 1680x1260px
Is Rust the new /g/ approved programming language?

https://www.rust-lang.org/en-US/
>>
fn main() {
println!("Yep")
}
>>
>>55486366
No.
>>
>>55486385
Why not?
>>
>>55486394
Just look at it
>>
>>55486427
Ok, let me see.

- Very fast, comparable with c++ fast
- No data races
- High level syntax with no runtime cost
>>
I'm starting to think that the rust compiler is a messy piece of crap, just like the C/C++ toolchain
>>
>>55486481
What makes you think that?
>>
Are you kidding me? I'm not even guaranteed an error on memory allocation failures. Pitiful language that wants to bring left-pad like dependency management to a cold world of unforgiving silicon. Oh, that part of the engineering design is black magic, you say? For others, it's a salary.
>>
>>55486500
>I'm not even guaranteed an error on memory allocation failures.

Why would memory allocation fail if you don't use `unsafe`?
>>
>>55486493
https://users.rust-lang.org/t/how-crossplatform-is-rust-really/6331
read comment #12
>>
>>55486530
Rust is full of creative individuals. There's a runtime, which is great. Look at Go. For some reason, there's this talk of low level programming with it. I don't get it either, but you know how novices are. At some point you're going to come across the barrier to an OS. Well, I hate to say this, but, OS's are different, and not just by their namesake. So, you know, what you get back from a memory allocation request is important, since it indicates things that only the OS could tell you without jumping into it. Maybe you don't. Rust doesn't fail exclusively on this ever; on a linux system the process aborts as is expected, which is great, but we haven't even penetrated the OS. That is understandable, though. That's why C-based real time operating systems exist. Don't know what this low level nonsense is about, rust couldn't power a car engine let alone a toaster. It's good for your parents' file server though, I give it that.
>>
>>55486659
So Rust shouldn't be used for a lot of unsafe cross platform low level stuff?
>>
>>55486530
>Why would memory allocation fail if you don't use `unsafe`?

ENOMEM?
>>
>>55486366
>sjw language
>/g/ approved
>>
Daily reminder http://robert.ocallahan.org/2016/02/rewrite-everything-in-rust.html
>>
>>55486861
don't worry, people are already rewriting everything in Go
>>
File: 7281.png (73KB, 2048x1024px) Image search: [Google]
7281.png
73KB, 2048x1024px
>>55486366
No.
>>
>>55486366
Yep.
>>
i see lots of js/python/go/web people fail at using it, why doesn't /g/ approve, this is the perfect language to make people question their abilities?

for real though: i like the synax and (its not that far from c/c++/java) and the way it throws error in my face when i mess up. the toolset isn't yet where it should be though, racer doesn't go through most of the auto generated ffi crates correctly and there are a lot of deskop/android/webassembly libs yet to be written. Although i got "cargo apk" up and running and that makes me a happy camper because seriously: fuck java.

the erros it throws could be better though.. it first throws all the syntax, then all the typechecking then all the borrowchecking failures. the checks for this could be done nicer on a file/function level basis so you don't have to refactor shit for the borrowchecker.

i never had a problem with allocating to much memory in any of my designs in the last decade, what do you guys code?!?
i have seen the design of some prorgramms that deal with large xml files on 32bit, but even them were latter refactored to not load everything into mem. you could potentialy also count your buffers lengths etc like you do in c, this problem is a meme
>>
>>55486914
Go has an atrocious syntax, Seriously what the fuck is this shit? :->??
>>
>>55486384
Why the "!"? Why is it called "println" and not just "print"?
>>
>>55489817
The ! means that it's a macro. There's a function that directly writes to stdout, but this allows us to do things like
println!("Hello, {}", "World")

Did you notice that I passed the string to format ("World") as another parameter? Rust functions only take a specified amount of parameters, macros can do special things.
>>
File: image1.png (13KB, 512x320px) Image search: [Google]
image1.png
13KB, 512x320px
>>55486444
>Very fast, comparable with c++ fast
It's comparable to Java, so no.
>>
>>55489908
Sounds overengineered.
>>
>>55489952
Why can functions only take a specified amount of parameters? That has to do with the type system. This is one of the things that makes Rust very safe. Macros can also do other very powerful things, take initializing a vector for example:
let x: Vector<i32> = vec![1, 2, 3];
[/code
Let's break this down
let x
This creates an immutable variable. If you wanted the vector to be mutable, you would say
let mut x

This makes you think about whether a variable has to be mutable or not, and is one of the things that makes data races impossible.
Vector<i32>
Vector is a generic type. The i32 means that x has a type of a vector with signed 32 bit integers.
 vec![1, 2, 3] 

How does this work? This isn't hard coded into rust, it's one of the powerful things macros can do. In other languages, you would have to do this for example:
 [1, 2, 3].toList() 

This makes an array, and then converts it into a list. Macros are a way to make syntactic shorthands to otherwise ugly or impractical things.
>>
>>55490020
I can't format.
>>
Seems rusty.
>>
>>55490020
So, in C++11 I just write
std::vector<int> x = { 1, 2, 3 };

This looks way cleaner and more intuitive to me than the rust code.
>>
>>55489908
So it's just a neutered printf?
>>
>>55486366
Its an alright game
>>
>>55486500
Custom allocators are coming, but that aside, if you're in an environment where allocations might fail, you shouldn't be using libstd in the first place, libcore has no heap allocation.

If you think memory allocations might fail on current operating systems, you're wrong, and even if memory allocation would fail, there would be no way to fix that, so crashing is a better idea.
>>
Apologies for the hijack

I'm about to wind up[ a faggot on this thread
>>693801197
by posting "your" when it's grammatically incorrect and should be "you're"

You can have your thread back now
>>
The SJWs aren't really a problem within the community, except on the main channels where they can be annoying every now and then.

The solution to that is just to have an unofficial venue where there's no retarded and useless CoC.
>>
>>55486937
fuck off nobody care about anything but code, a vast majority of the dev are straight white male btw
>>
>>55490709
>The SJWs aren't really a problem

Most of the Rust core team spent the last week at BLM protests in SF instead of doing their fucking job. Mozilla actually gave time off for people to go protest.

The Rust core team will pick SJW causes over technical excellence every single time.
>>
>>55490853
I can't find this at all.

Not saying I don't believe you (certainly sounds believable imo) but I'mma need a citation.
>>
>>55490876
Ask Klabnik or any of the Mozilla employees in the Rust IRC channel. Most of the Rust related IRC channels have been flooded with political garbage for weeks.

Meanwhile, Rust is going nowhere because the real problems are never being addressed. The vast majority of crates still rely on nightly and unstable features with little hope of that changing in the near future.
>>
>>55490939
The vast majority is kind of false.

The ones that people actually use and require nightly aren't that many.

For instance serde or parser generators, but they're compiler plugins and it would be dumb to stabilize something like that so soon.

Nonetheless they're working on fast tracking a different set of compiler plugins that satisfy certain criteria in which serde and parser generators fall into, so they can be stabilized.
>>
>>55491391
>The ones that people actually use

That says more about the non-existent real world use of Rust than anything else.
>>
>>55491444
I was specifically referring to nightly only crates.
>>
>>55486366
It's trash
>>
>>55491444
Dropbox is a pretty big user of Rust, they use it internally quite a lot
>>
>>55486724
You have cpp for that
>>
Rust is a very good language, will probably win from go.
>>
>>55490822
>a vast majority of the dev are straight white male btw

Huh, no wonder Rust is so good.
Thread posts: 46
Thread images: 4


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