[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/Rust General/
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 125
Thread images: 6
File: Rust General.jpg (35 KB, 1680x1260) Image search: [Google]
Rust General.jpg
35 KB, 1680x1260
Rust, the most promising general purpose multi-platform programming language
>>
>>53710709
Rust has everything but majority marketshare because most developers are fucktarded and can't be arsed to do a good thing for themselves and learn it.

Borrowing - fucking genius
>>
>>53710751
Then use it to make a good application and fuck what others think
I heard it can work as a good elixir alternative which is why it interests me, no one has really thought of using it that way because the thought of using a systems language to write a web app scares most people
>>
I'm not going to lie, I can't find much fault with rust, but the goofy weird syntax just throws me off so badly

t. D programmer
>>
>>53711298
also some questions
how hard is it to DEFINE higher order functions in rust? e.g. reduce / foldl
T reduce(alias func, T)(T[] input, T seed)
{
T accumulator = seed;

foreach (T element; input)
accumulator = func(accumulator, element);

return accumulator
}

an important thing here is that the function is passed at compile time, so there's no indirect calling nonsense (and type errors and mismatches in the number of arguments are always caught statically)

I imagine using them is pretty easy
array.reduce!((a, b) => a + b)(0);

that's how it works in D
>>
>>53711298
D is for D E A D. Rust is what D could have been
>>
File: imperative programming.png (289 KB, 580x346) Image search: [Google]
imperative programming.png
289 KB, 580x346
>>53711380
>D
>>
>>53711588
>>53711650
>D thread yesterday
>hundreds of posts
>rust thread
>ded after 6
rust

more like

more like dust
>>
>>53711672
4chan could grok the game change that is rust if they tried
>>
>>53711650
>post about higher order functions and lambda expressions
>nice imperative programming
>>
Rust -- the thinking man's language.
>>
>>53710709
>>53711298
>>53711588
>>53711685

Rust is an autistic meme language, it will never be used because you don't just pull a language out of your ass for no reason at all.

Go is developed by Google (yet still failing) as a "New C," Swift is developed by Apple for iPhone apps.

That's the reason those 2 meme languages are being used, Rust has no platform except "muh memory safety, no garbage collection!"

Nobody gives a fuck, learn how to computer and write the shit in C; if you have memory probably its because your a retard and shouldn't be programming.
>>
>>53711720
memory problems*
>>
>>53711720
>Go is developed by Google (yet still failing) as a "New C," Swift is developed by Apple for iPhone apps.
Go has several shortcomings that make it unsuitable, namely the type system for starters.

Rust is the new C, hands down.

Reasons to use Rust over C
> Guaranteed memory safety, for starters
>never have a dangling pointer, buffer overflow, or segfault again because the code won't compile because of a concept/feature called "borrowing"
no need for learning a variety of "safe"coding styles like in C/++ because Rust removed the problem from existence.

plenty more reasons in this video for when you have the time
https://www.youtube.com/watch?v=d1uraoHM8Gg
>>
>>53711727
>>53711720
I think the point of it isn't that you can just be a total fucking retard and have it still work, the point is that code that would segfault is rejected at compile time because the type system is more powerful (or something - I don't know rust)
>>
>>53711784
>because the type system is more powerfu
because it has a borrow checker

if you skip to around 13 minutes in the video >>53711748
he explains borrowing you'll be like duh this should be in every language
>>
>>53711380
Rust has Iterators that include fold. So you get the iterator somehow
foo.iter().fold(seed, |s, x| s += x);


FP in Rust is there, but it doesn't feel as nice as FP in Haskell or OCaml.
>>
>>53711811
I'm watching the whole talk
I'm pretty interested
>>
>>53711840
I mean how is it defined
presumably it's in the library, right? What module is it in?
>>
>>53711748
>>53711784

Hi, I'm Anon and this is 4chan. By default, I talk mad shit to everyone and am very disrespectful; this helps to seperate the autists from the people who I can actually have a conversation with.

>serious mode

I'm well aware of all the advantages of rust, and just for the record you can write unsafe code if you need to in rust.

What I am getting at is that people don't use things until you force them. The fact is people only use Java because they were forced to learn it in college and then Google started using it for their apps.

People only use Swift because its a better alternative to Objective-C; again for apps.

They are forced to use these languages, I'm well aware that Rust is a good language and is competent enough to replace C; but it won't because anything you can do in Rust you can do in 10 other languages that have been around for 10-20 years at least.
>>
Mozilla Servo 500fps browser layout engine

https://www.youtube.com/watch?v=BTURkjYJ_uk

written in Rust because it's impossible in other languages because you'd get dangles and have a ton of memory leaks, segfaults and other security vulns on a problem that large
>>
>>53711849
There's a trait (interface) Iterator in the standard library.

If you have a custom data type and want to make it iterable, you have to implement that trait. All you have to do is implement a function next() that returns the next item or None at the end. If you've done that, you can use map, fold, take, zip, ... automatically.

http://doc.rust-lang.org/std/iter/trait.Iterator.html
>>
>>53711853
anything you can do in any turing complete language you can do in another turing complete language
it's all x86 binary under the hood
>>
File: Screenshot_20160327_212027.png (99 KB, 581x500) Image search: [Google]
Screenshot_20160327_212027.png
99 KB, 581x500
>>53711883
what the fucking shit am I looking at here?

>All you have to do is implement a function next()
that's pretty similar to what D does, except you have to define bool empty, void popFront and T front
seems like rust's way is a bit better desu
although I'm sure if you ask the guys who wrote D's one, they'd find some reasons to disagree
>>
>>53711877
actual demo
https://www.youtube.com/watch?v=erfnCaeLxSI
>>
>>53711877
not if you were a competent programmer; language doesn't matter.

Further proof rust is a meme when you have to pretend it is the only language that can do something.
>>
>>53711932
you've never worked on a large project before in your life. in real life shit gets dirty. a language that prevents bullshit mistakes at compile time because it can is the way of the future.
>>
>>53711894
what the hell does that have to do with what i'm saying?
>>
>>53711941
No, it isn't.

Nobody but Mozilla is using Rust.

It is a meme language.

Just because a problem isn't easy, doesn't make it impossible.

>you've never worked on a large project before in your life
K retard, tell me more about me I sound interesting...
>>
>>53711963
hey, sshhh. watch this.
>>53711929
>>
>>53711966
yeah I know, it's what i'm talking about faggot.

Same thing can be done in any other language, Rust just holds your hand because its for coffee shop retards.
>>
>>53711949
>anything you can do in Rust you can do in 10 other languages that have been around for 10-20 years at least.
My point is, sure you can do everything in any other language, but the fact that the compiler can catch as much as it does statically without chaining you to a desk and bubble wrapping everything sharp is pretty fucking new
>>
>>53711981
hey, shhhh.

you need to watch this (aka, why they did it in rust) next
>>53711877
>>
>>53711981
>coffee shop retards.
when you project this hard you're just as identitarian as the people you supposedly hate
>>
>>53712028

I never claimed to hate anyone; I just find it funny ITT people think Rust is the only language to use because it holds your hand.

That is not a good reason to use it.
>>
File: 1459077632897.gif (30 KB, 220x300) Image search: [Google]
1459077632897.gif
30 KB, 220x300
Is it good to learn it for a total (and I mean total) newbie ?

Or do I begin with C++ ?
>>
>>53712051
It's not hand holding. It's called intelligent, iterative design. Learning from past mistakes, something you should probably put near the top of your todo's
>>
>>53712063
Yes, it's just as easy to learn as C. And you don't have to learn it all at once to start using and benefiting from it. Having said that, it's a concise language.
>>
>>53711917
It's all lazy so the types are functor combinators
>>
>>53711932
Nah, competent programmers aren't going to continue to use shit languages if a better one comes
>>
>>53711720
>your a retard
>memory *problems
Case.
Closed.
>>
>>53712063
If you want to use language in real job - go for c++ as no one using rust in business, just some autists with free time.
>>
On an unrelated note, where can I get a C book with complete details of the language? GNU C reference manual comes close but I want something totally comprehensive. thanks (no K&R, already read it)
>>
>>53711917
D prefers ranges, not iterators.
http://www.informit.com/articles/article.aspx?p=1407357&seqNum=2
>>
>>53712236
Actually, they often are, because they are already hired to do so.

A new cool programming language won't replace tens of thousands hours of work or what the team and company is familiar with so easily.

That said, I'm not seeing Rust as a winner even for random independent software projects at this point. Go and Scala are way more promising...
>>
>>53713252
The ISO C standard. Only issue is that any given revision is fucking expensive, but unless you're writing an implementation or something you can get by with the drafts, which are publically available for free.
>>
>>53713569
Nice thanks, I just hit on one that's bout 2000 pages, I think it'll do for now lol. I might have to pick up some GNU C compiler syntax scattered around the net and some syntax that's not all that familiar and might not be in the books by brute searching, wish all of it was in one place.
>>
>>53711720
>C++ speeds
>safe
>no shitty archaic build system
Why the fuck would I still use C?
>>
>>53710709
That's not ocaml.
>>
>>53710751
Maybe if it weren't for the cock of conduct it would be taken more seriously.
>>
>>53713990
>using C in the first place
C has been deprecated since before it was even invented (true story).
>b-but muh speed!
Fortran and forth already existed. Lisp was significantly faster at the time, too. It took 2 decades before a non-shit compiler for C appeared and it stopped being slow as balls.
>>
C++ fag here. Didn't like how the compiler made huge binaries. Why should I switch again?
>>
>>53714043
Because storage space is cheap, but critical bugs that kill thousands aren't.
>>
>>53714061
Where are these bugs?
>>
>>53714043
>Didn't like how the compiler made huge binaries.
That's just the default settings. Plus it's really not a big deal.
>>
>>53714151
Where are these settings at?
>>
>>53714191
man rustc
>>
>>53714209
Not an argument.
>>
>>53714070
therac-25, y2k, that one plane, that one nuclear powerplant, etc.
>>
>>53714361
>therac-25
Was sloppy engineering that could happen in any programming language
>y2k
Also nothing to do with choice of programming language
>that one plane
I assume you mean the Dreamliner bug. Rust disables overflow checks in release builds, so your plane would also crash if they didn't catch it during debug testing.
>nuclear powerplant
?
>>
>>53714650
Found the inbred
>>
>>53714361
I didn't write any of those.
>>
>>53711298
Could someone explain to me this "t. X" meme? I have a hard time googling it.
>>
>>53714720
>I
You may be joking, but that's pretty much every fag who actually thinks C is good in any way's only defense on /g/. It's just sad.
>>
>>53714807
>pretty much every fag who actually thinks C is good in any
C is really good at what it does: directly fucking with memory.
It's just that lots of people seem to think that their particular task requires fucking with memory, when it would actually be better to leave the memory unfucked.
>>
>>53714807
I don't care about C. I'm looking to see why I should use Rust over C++.
>>
>>53714928
C++ is significantly more solid than C to begin with, but rust has uniqueness types which means the same speed as manual memory management, but without any of the risks. It also has ML-style functional constructs which makes programming at a much higher level, without loss of performance, significantly more plausible. Thus, it reduces development time significantly while affording better safety guarantees than C++ without the overhead of magic_ptr.
>>
>>53714743
t. newfag
>>
>>53714743
t. r.eddit
>>
>>53711720
Sounds like someone didn't get hired because all they know is C
>>
>>53714978
>>53714998
>everyone is required to know every shitty meme
>>
>>53714702
Wow, great arguments you got there.
>>
>>53711990
It's not new at all, but it's new in a pseudo-mainstream language. For years, we've had not only uniqueness typing as in rust, but also full linear typing and dependent typing, which allows not only preventing whole classes of memory errors, but fully preventing resource leaks of all kinds, such as fd leaks or gpu resource leaks, as well as compile-time bounds checking and compile-time pre-condition - post-condition verification.
>>
D seems to have a higher chance to get into mainstream since it looks more like C++/C, while Rust invents it's own syntax.
>>
>>53715282
D has no chance to go mainstream because it's C++ with java features tacked on: no advantage over C++ for C++ tasks, no advantage over java for java tasks.
>>
>>53715282
Rust has way more mainstream attention right now than D.
>>
>>53715357
How do you define "C++ tasks" or "java tasks"?
D, compared to C++, has much better meta-programming facilities (templates, mixins) and properties, for example.

Java isn't even worth comparing. It's a shit language without basic functionality like unsigned integer arithmetic. If you want a VM-based language to compare with D, use C#, which is like Java, but actually good.
>>53715396
Where's the attention? I only know Mozilla is working with it. Actually, both Rust and D are very niche currently and I think both have a chance to be then new sepples.
>>
>>53715450
C++ tasks: high-performance desktop programming and os-level and embedded development.
Java tasks: muh enterprise.
>>
>>53715450
Templates and mixins in D are just a poor man's cross of C++ templates and java generics with header cleverness.
>>
>>53715462
Both D and Rust are general-purpose systems programming languages like C++, but better.
>muh enterprise
I don't think D or Rust compete here. C# is.
>>53715476
>a language shares features from a few other languages
>this is somehow bad
In either case, D's meta-programing is much better than C++'s. And it's also easier to use and more readable. The mixin statement is a killer feature for me.
>>
>>53715538
Top lel. Nobody will use your gay language, fag. No need to shill it, it's already dead.
>>
>>53715608
>enjoying shit
People like you are the reason we can't have nice things.
>>
>>53715450
>Where's the attention?
It shows up on blogs / news-sites more often.
So far neither have any real commercial adoption.
>>
>>53715637
Oh the irony.
>>
>>53715450
> use C#, which is like Java, but actually good
C# is too Windows-specific and its libraries and software are mostly sub-par or walled gardens - not really worth bothering with.

Java is a bit of a dinosaur, but it's a *mighty* dinosaur. Tons of powerful software and libraries exist for it, and then of course it also has the most popular end-user OS.
If you want a more syntactically appealing upgrade to it, go with Scala or Kotlin or Clojure or something else that runs on the JVM.
>>
>>53715050
Kys
>>
>>53715608
>>53716249
Underage fags like you are the reason g is completely in shambles.
>>
>>53716357
Shills like you wouldn't have been allowed on /g/ pre-2008, my friend.
>>
>>53715282
The "hip" language syntax of Rust is what really puts me off. Why not just use sane, readable syntax instead of some letters which supposedly looks like you're a cool hacker, but provides 0 actual benefit.
Go is just at the limit with it's "func", which makes it a pretty doable language, unlike Rust which is just a fucking meme for hipsters that don't want to learn C/++
>>
What's the go-to UI framework one would use with Rust?
>>
>>53713555
Still thinking go is going anywhere, no pun intended. Rust is a better Go
>>
>>53714242
>afraid to read clear documentation
And you call yourself a developer?
>>
>>53718400
>t. Lambda Calculus failure
>>
File: 1449014249068.gif (2 MB, 300x290) Image search: [Google]
1449014249068.gif
2 MB, 300x290
>>53715357
I don't think you've ever used D or read any books about it.
>>
>>53721508
Shill harder.
>>
>>53718400
Mr. >>53721130 is right, senpai. Read a book some time. Lambda calculus looks like a mixture of the bad parts of C++ and the bad parts of OCaml.
>>
>>53721508
It feels like rust has a clearer selling point than D. Memory management seems like a bigger feature than whatever D does... cleaning up C++ syntax or something?
>>
>>53724243
Go does pretty much everything wrong desu. It's unwieldy, buggy, unrobust and tedious to program in. It doesn't even support dynamic linking.
>>
>>53724243
D is C++, cleaned up, plus baking in idioms discovered to be useful in the decades since C++ started.

Then shitting all over that by adding mandatory GC.

Then trying to backpedal on that starting sometime about a year ago, when it was far too late.
>>
>>53724243
I think you kind of have to use D to understand the advantages over C++
It kind of just cleans up everything. Everything that should be builtin is, rather than being awkwardly tacked onto the standard library. It's consistent from the ground up. It supports functional programming pretty well, notably at compile time

The point of D, vs. C++, is that absolutely everything in the language is a bit cleaner, a bit nicer to use, a bit simpler and a bit more powerful, but the language is still completely intuitive for someone coming from a C style background
>>
>>53724372
Oh yeah, and the compile times are fucking ridiculously fast
I've had 5k loc projects with heavy use of templates that still compile instantly
>>
>>53724422
So, just like in c++ then.
>>
>>53724460
5k loc C++ projects don't compile instantly for me anon
>>
>>53724495
stop using a pentium 3 then.
>>
>>53724460
>So, just like in c++ then.
Uh, long-ass compile times is probably the third most common complaint about C++.
>>
>>53724596
Yes, on millions-lines, heavy-templated codebases.
>>
>>53724595
I'm not
I'm on a laptop
Still, the fact that a 5k line template filled D project compiles as fast as hello world in C++ is pretty ridiculous

I mean, sure, if you're using a single cpp file with no headers, no templates and no includes to the standard library, it's probably not going to take THAT long, but nobody does that
>>
>>53724356
You can avoid GC in D when you need to, and guarantee its non-use with the @nogc attribute.
>>
>>53711720
Swift is free and has a compiler up for linux already
it's better than rust if you are not autistic
>>
>>53712063
C++ is simpler than rust, so that says something if a beginner should learn it
>>
>>53726227
Best joke in this thread so far.
>>
>>53724983
And not be able to use the stdlib, no thanks.

I'd rather have a GC free language with optional GC, not the other way around.
>>
>>53710751
I work in embedded systems at a company where we use C almost exclusively. The problem is that most of the developers who would be into rust dont hang with the web dev crowd that makes it. They simply haven't heard of it except in passing. I have the greenlight to use it next place it makes sense to do so, but since all of our infrastructure is for C, finding somewhere that its legitimately a good idea is hard.
>>
>>53727329
How do you get into embedded dev, if I may ask?
>>
>>53726227
0/10

why should i use rust instead of D? the syntax is retarded compared to D which is basically C but better
>>
>>53714743
The "t" is short for "terveiset" in Finnish, which roughly translates to "regards"
>>
>>53727365
In my case, I was a web dev who knew Linux really well and C well enough. Went to a hackathon with a friend and afterward he asked if I was looking for a job since his team was expanding. Basically, I got really lucky. No one would have considered my resume for the position had it not been for that.

The way I see most of my coworkers got into it is a degree in either CS or electrical engineering. Your requisite skillset will probably be C, at least understanding circuit diagrams and electronics, skill with using Linux, and understanding Linux under the hood. For that last one, there's a book I recommend called Understanding the Linux Kernel. It's free online. If you don't have said skills/credentials, it would probably be pretty hard to get to the skill level you'd need. I wasn't there when I started, and it was grueling getting up to speed.
>>
>>53713485
Because C++ favors ranges because D is just sucking C++'s cock
>>
What does it do better than Ada?
>>
>>53728305
What does Ada do better than Rust? What good is Ada for anyways?
>>
>>53728995
absolutely nothing
>>
Does anyone know how complete and compatible to new versions the scientific crates, like SciRust, are?
All the ones I found haven't been updated in months to years
>>
>>53710709
The language is unproductive as fuck.
There is just to much safety checking.
It's not like I'm programming space rockets, I can afford a few bugs.

Don't get me wrong. The rest of the language is good. But the error checking is just to aggressive.

Why can't we just have C with some quality of life updates.
>>
>>53711298
D is the poor man's java
>>
>>53724983
>You can avoid GC in D when you need to, and guarantee its non-use with the @nogc attribute.

@nogc is effectively worthless because you can't really get around GC in the standard library, and you have to annotate essentially everything with the directive in order to get the result you want.

Starting out with GC was D's prime sin, since they can't really back out of it effectively now.
Thread replies: 125
Thread images: 6

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.