Rust

Legit rust thread, what are its pros and cons?

Attached: 1542112082531.png (500x700, 134.46K)

Other urls found in this thread:

blog.rust-lang.org/2015/05/11/traits.html
github.com/rust-lang/rust/issues/24111
play.rust-lang.org/?gist=1e29419fe38b12055b9d992da85cd0e9
benchmarksgame-team.pages.debian.net/benchmarksgame/faster/rust-gpp.html
cplusplus.com/reference/map/map/
en.cppreference.com/w/cpp
fluentcpp.com/2018/02/09/introduction-ranges-library/
cplusplus.com/reference/algorithm/for_each/
en.cppreference.com/w/cpp/utility/optional
en.cppreference.com/w/cpp/utility/optional/operator*
duckduckgo.com/?q=safe subset of C
stackoverflow.com/questions/29951591/is-misra-c-applicable-to-linux-applications
port70.net/~nsz/c/c99/n1256.html#6.3.2.3
en.cppreference.com/w/cpp/algorithm/transform
beta.rust-lang.org/.
reddit.com/r/programming/comments/a1jjyg/a_new_look_for_rustlangorg/
en.wikipedia.org/wiki/Variable-length_array#C99
twitter.com/AnonBabble

cons:
coc
cant get a job with it
meme lang
made by literal antifa members
worst performance then C
not compatible with pre-existing C++ libraries unlike D
good luck finding hardware support ie microcontrollers and other embedded systems, since you are forced to use their compilers.
pros:
if you want to be a hipster and know an obscure language and jerk off about it. Its the way to go.

Pro:
- forces you to write somewhat safe code
- software is fast

Con:
- steep learning curve
- some features missing, such as integer templating or function multiversioning
- limited to few architectures
- default package repository is hosted on github
- CoCed ecosystem

It's almost as ugly as C++. Which is kind of retarded for something made to replace it.

I've literally been asked about my opinion about rust during a job interview. I have a strange feeling that if I told them I liked it I would have gotten the job.

Pro
- "zero cost" is the appropriate cost for lots of abstractions
- decently sized community and state of resources; the "too many lists" book is pretty good
- minimal runtime, makes it appropriate for sysadmin tasks where performance matters just enough that you can't use a scripting language
- cures cancer - safe memory management without a GC
Con
- the magic is inside a black box, and not your own: the borrow checker is a feature from on high that you negotiate with or re-utilize. It's arguable whether this is a con: when languages give you the magic, you also have to deal with idiots who misuse the magic in programs you come to maintain. But since Rust doesn't pretend to be a better-for-maintainers language, I think this limitation is one of the developers' imagination, rather than a limitation by design.
- the community is a obscene, writhing teratogen. "Dining with Communist Philosophers
these cons, plus more interesting languages Ada, ATS, Zig, is such that I haven't learned the language well enough to provide other cons. I thought rustfag did well with it in last year's advent of code.

it's retarded if your goal is "a language prettier than C++"
if your problem with C++ is that it's too hard to understand, that it's too easy to write pessimal C++, Rust might seem a lot better. I've heard of cases where a print statement accidentally aliases a variable and slows Rust down by an absurd degree, though.

faster than c++?

Attached: herbs.jpg (648x1052, 75.84K)

I don't know.

Also a neat feature that I forgot: it has .map() and ranges and Option monads, which C++ does not have.

It's C for faggots.

rust fags are just making up stuff now

Why would I make up a story about not getting a job? It was a faggot soy franshitsco company and were probably just asking to troll me anyway.

What was the job for? Communist book store clerk? Bathhouse towel boy? Antifa webmaster?

I could tell you but you would have to abide by my Code of Conduct.

How did you respond and did you reveal your autism?

Attached: please-respond[1].jpg (652x458, 123.42K)

you are delusional

there is literally nothing wrong with antifa

Rust is for gay niggers

nothing that death and then damnation won't cure, anyway.
or, in a sane country, the normal operation of justice.

I, Steve Klabnik, am here to answer all your (serious) questions about Rust.

Attached: steve klabnik j.jpg (1280x720, 32.88K)

Is Rust a Satanic agent?

How does it matter if you just use it?
Extraordinary claims require extraordinary evidence.
This word combination doesn't have a meaning.
How does it matter? Are there any Hitler checks in the compiler or what?
Extraordinary claims require extraordinary evidence.

So what did you actually answer?

I remember. He suddenly disappeared when it was finally time to deal with tree-like data structures, for an unknown reason but you may guess why.
define "scripting language"
it's the implementation that decides performance
take a look at Cython or PyPy.

Yeah these are the main points. Also it has rather good type system, clearly borrowing some good parts from Haskell.


for equal effort spent by the programmer, likely yes.

Forcing you to do anything is never a pro unless you're doing scriptkiddy shit.

so everyone who's not using assembler is a script kiddy, also anyone who cares about security and stability is also a script kiddy, got it.
even C forces you to respect type system somewhat, and to write code in more or less structural way
or if we get really pedantic then this
is also not really true for Rust as you can ignore the rules where you want it, using 'unsafe' and then it doesn't really force anything anymore.

Yes. Rust is programmatic hedonism, C is self-discipline.

a language where you write and run scripts. The most important part of that for system administration is that scripts are always deployed as source code, so when you need to look at them on a server you can always see, troubleshoot, and modify the source of the script at hand. You never need to, before you're even sure that this program is relevant to your problem, track down the thing's source (if it's even available)
there are corresponding negatives. Some jerk can modify a script and then you can come along and run it while thinking it's the usual version
but it's a very practical combination of features.
>implementation language
yeah, yeah. A lot of hacker rhetoric can be explained as the hacker not wanting to feel inferior to some other hacker. It's not that Bob over there gets to write serious shit in SeriousLang, it's that seriousness is a meaningless distinction and all languages are the same. conceptually. with a sufficiently advanced compiler.
At the end of the day that Python program you're writing is going to be executed 100% of the time by /usr/bin/python3 in various CentOS environments and therefore will spend two weeks searching various fatty crevices of the filesystem for libraries before it can print a simple "hello world", and if you don't want that kind of overhead your next best bet is usually C.
it's rare that languages really do blur this particular 'meaningless distinction'. I know because I was inspired by some Perl troubleshooting to go looking for any language+implementation like this. OCaml's one.

C is a verbose and restrictive BDSM language. Forth is self-discipline.
...
here's a language category for you: go fmt languages, that relieve the programmer of having to care about code formatting--his own or that of other people.
go is 100% such a language.
Python is a weak 30% go fmt language, only ensuring that your programs have some kind of indentation.
Ada is a strong 80% contender, only hampered by its huge list of style flags that can vary from repo to repo. also, technically, there are compilers other than gnat, which might not have a gnatpp
Common Lisp and Java are 50% go fmt languages: in practice, any serious person writing either is using an editor that does most of the formatting for the programmer. It's still possible to come across a rube writing Common Lisp in nano, who formats it like C, but at "50% go fmt" it's already acceptable to flame people like that.

Pajeet detected.

...

History teached you nothing.

Most languages allow that.
for a harmful dude, modifying a compiled blob is also doable.
there are better ways to solve that, when it actually becomes a problem.
first, Python files are translated to bytecode (which has minimal starting overhead to interpret) and you can choose to keep it. second, if you launch a process so fucking often, why not change the code in such a way that you will keep it alive instead. third, you can use OCaml, Zig, Rust, whatever else, C is really a last resort as you'll have to deal with UB left and right.


you're talking out of your ass
it has better compile time evaluation routines than C++ (which, it seems, is your ideal but is actually a pretty low bar)
next points are just lol


this is irrelevant as it's trivial to add a rule that any code is not accepted which doesn't pass automatic style check. and all mentioned languages have appropriate tools (except C perhaps, but I think it had some too)

wtf?? If your scripting language doesn't offer enough performance, use luajit or similar.


>>>/oven/

Attached: terry1.png (990x682, 312.57K)

whatever dude. Every language mentioned in this thread is Turing complete. You bow to practicality in one area but not the other, probably because you have experience in one area but not the other.

>>>/oven/

There was at least one other Rust fag except for me. I (Steve Klabnik) solved all the challenges. Check the archives.

If yuo never played it you're not a faggot
You're a faggot

found the anti Rust shill

wrong: blog.rust-lang.org/2015/05/11/traits.html
RFC has been accepted: github.com/rust-lang/rust/issues/24111
wrong: play.rust-lang.org/?gist=1e29419fe38b12055b9d992da85cd0e9
wrong: benchmarksgame-team.pages.debian.net/benchmarksgame/faster/rust-gpp.html
not surprising considering that the language is pretty young
not an argument
proof?
proof?
D isn't abandoned though

literally all of those are built into standard c++

lmao the freeCOCS nigger is a rust shill. priceless

Post links to the documentation or show code samples, please.

Maps: cplusplus.com/reference/map/map/
Optionals:
en.cppreference.com/w/cpp
Ranges:
fluentcpp.com/2018/02/09/introduction-ranges-library/

You are literally 3 clicks away, faggot. Try harder.

>Maps: cplusplus.com/reference/map/map/
That's not .map()
>Optionals: en.cppreference.com/w/cpp
Nice. Didn't find that on cplusplus.com.
>Ranges: fluentcpp.com/2018/02/09/introduction-ranges-library/
Not supported as of C++17

Ranges of the style `for (auto x : mylist) { ... }` have existed for years
Yeah IDK why he posted that. C++ has map it is just called:
cplusplus.com/reference/algorithm/for_each/
Everything in c++ is based on iterators so that you can do things like map over subsections, or map in reverse, etc.
He did not link to the sub page it is here:
en.cppreference.com/w/cpp/utility/optional
But note that Boost has had optionals for years.

>cplusplus.com/reference/algorithm/for_each/
This isn't map though. Map lazily applies a function to every item of the iterator thus forming a new Iterator.
>en.cppreference.com/w/cpp/utility/optional
en.cppreference.com/w/cpp/utility/optional/operator*
LOL.

not necessarily
map is a meaningful operation on non-iterable container types, such as optional.


That's not the kind of range that I meant. I was talking about what you'd get with range(1,10) in Python or (1..) in Rust or [1..] in Haskell. You can build those with generators, but those aren't there yet in C++.

Map being an iterator is an implementation detail. If you ask people in most languages for map, they'll show you a map that isn't one. If you port some code using map to most languages, you'll readily swap out the iterator for a non-iterator.
I take it Rust and JS are the only two languages you know?

no, what it's gotta do is take the common errors out of iteration, and C++ has done that for ages. Ada does it as well with 'First 'Last and 'Range attributes.

We are talking about Rust's map. So yes.
Optional is a collection that can contain up to one element. Why shouldn't it be iterable?


We are talking about Rust's map.
I don't know JS. I know a couple of languages besides Rust.

No, we're talking about map. If you want to talk about "Rust's map", then never drop the "Rust's", because trivial shit like Rust's map being an iterator has nothing to do with maps. If someone handed you an iterator-based map or a range object in C++, you wouldn't even want it.

wrong:
"it" as in Rust. It's fine to admit that C++ doesn't have an equivalent to Rust's map.

C++ does have an equivalent of Rust's map. It's for_each. It's what you reach for in C++ in cases where, in Rust, you'd reach for Rust's map. It's fine to admit that languages have features without obsessing about trivial shit. You didn't say "Also a neat thing about Rust is that its map is lazy."

C++ for_each applies a function eagerly to every element of the iterator. It then returns the function. That is not an equivalent to Rust's map. It is basically Rust's for_each.

See
"it" as in Rust. It's fine to admit that C++ doesn't have an equivalent to Rust's map.

Generators aren't (necessarily) objects but coroutines, which again C++ doesn't support yet. And infinite ranges are useful.

...

ok kiddo

C lets you cast from anything to anything, as it should.
C has goto, as well as functions and structured loops and so on

What I don't get is this: c lets you write terrible code, but rust has a keyword to do the same thing. Hasn't anyone tried introducing a safe subset of c that could be statically analysed?

duckduckgo.com/?q=safe subset of C

Nobody would use it. After all C is already "perfect".

stackoverflow.com/questions/29951591/is-misra-c-applicable-to-linux-applications
so not unless you're working on embedded software.
for typical 'safer C' projects, the timeline is
1. let's make a safe subject of C!
2. oh shit. that means C with its arms and legs sawed off. Let's add some bionic limbs, to replace pointer arithmetic, etc.
3. oh damn, this is now a completely different language isn't it? Why would anyone even use this when there are already all these better-designed languages that are already safer than C?

condensed timeline:
1. let's use C!
2. oh shit
3. oh damn

There would probably be more work done on that if C/C++ had a sane module system where dependencies were compiled separately.

No it doesn't. Perhaps your compiler does, but that'd be undefined behavior.

port70.net/~nsz/c/c99/n1256.html#6.3.2.3

en.cppreference.com/w/cpp/algorithm/transform

Can you safely cast from integers to pointers? Or from pointers to arrays of char?

Yes
I don't know. I'm not a C programmer. I linked you the specification.

the worst-specified language has the most specification lawyers.

Then what memory area does it point to? Sounds like this is not going to work on harvard architectures.

As I've already said, I'm not a C programmer. I'm done spoonfeeding you. Read the spec yourself.

search performance benchmarks between C and Rust. maybe there is a few examples where rust pulls ahead slightly but for the majority of the time C rules nigger.

I want to like rust because i want a language that makes threading easy but
fuck

Attached: 1484959738753.jpg (640x480, 27.31K)

Have you looked at Ada?

LARPer spotted

I will never understand how complaining about syntax makes you a LARPer. A LARPer wouldn't give a shit about syntax because they never write anything anyways.

A programming language is a tool. It doesn't matter what it looks like, it matters how it performs. Only a LARPer would complain about how a tool looks.

Rust has a shiny new website at beta.rust-lang.org/. Can't screenshot because torfag.

shiny.
new.

Ada is readable and gnatpp solves formatting, but I can't type it the way they want it. I modified ada-mode in Emacs to autotranslate - to _ identifiers, so I'll enter procedure what-the-fuck isand Emacs'll showprocedure What_The_Fuck is and then I gnatpp that later for horizontal alignment and spaces before parentheses and such.

Isn't that the main selling point of go? I'd actually love to get peoples opinion on that language over rust since at least to me it seems superior. Note I've only superficially looked into both. Pls no bully.

rust succeeds at being so cancerous even at making its own website that the reddit response is generally good: reddit.com/r/programming/comments/a1jjyg/a_new_look_for_rustlangorg/
These statements are neither false, nor useful. There isn't a programming language that discriminates.
klabnik:
THEY TOOK THEIR OWN LANGUAGE OFF THEIR OWN WEBSITE BECAUSE NOBODY LIKED IT

meh, Go concurrency uses channels for intertask communication. It's the kind of system you get when your #1 goal is cheap parallelism and then you say, OK, how do I also use this for concurrent design?
Message-passing in Erlang (with receive) and Ada (with accept) is a lot nicer. I've heard that go's channels aren't that performant.
the main selling point of go is not having generics

Can someone tell me what big important projects they are working on that requires an entirely new language that cannot be addressed by the hundreds of thousands of libraries (many are duplicate objectives) available for C, C++, Java?
If there are faults/bugs in those libraries, why can't you as programmers go in and fix them without having to write an entire new language, a new compiler, bring people into adopt it, and then have them spend another decade or two writing the exact same libraries again?
How is that not backwards?
Why is that progress?

...

whatever happened to Adafag? was that just some LARPing? have you since switched to Rust?
me, I just reimplemented a raytracer that had a mutating dynamically-allocating C++ class: a vector of three floats, with math overloads. As I started out I kept griping about how I'd do it in Ada, particularly about how I'd manage memory and about Ada not having += operators.
I wound up with an immutable vector object in a 100% stack-allocating program. How the hell did that happen? The natural thing to do in C, if you want a function to return a new collection, is to allocate memory for it and return a pointer, and then document that the caller needs to free that memory. In Ada though, since procedures have 'out' parameters and since functions can return collections directly, what happens is that the caller's always responsible for memory. So the caller can just stack-allocate what you'd naturally heap-allocate in a callee in C. Of course it's also possible to do it the Ada way in C, and that's even common with syscalls (*stat(), getdents*()), but it's not natural so you see a lot more heap allocation.

Prove it instead of making bullshit statements.

Pros:
Linear Types

Cons:
Literally everything else

Just use idris with linear types so you can write your device drivers in an actual functional language without the garbage collection.

You could use ATS, which is simple enough if you don't get more advanced than linear types, and which actually permits you to not use GC. Idris totally has a GC though, and it's in even more of an 'experimental' state than ATS (technically the author's fourth iteration on the idea); simple 30-line Idris programs can take 45 seconds to compile.

...

Why is Zig Forums fucking dumb?
I know MIT is dumb fucks,
but Zig Forums? Pshh.

Rust has affine types, not linear types.
Iris does not have linear types either for that matter.

Idris has Uniqueness types which are effectively the same thing.

The memory location "of the first char", if you converted for example 1 into a char *, it would point to the memory location 1. I'm 90% sure that's how it worked

sudo apt-get remove rust* libstd-rust* cargo*

sudo apt-get remove snapd* libsnapd*

There's many things you can't do no matter how many libraries you tack on because the language doesn't support the functionality required. For example there's no such thing as a dynamic array in C that you can use with array[i] syntax instead of some hideously convoluted mess of function calls and type casting.

this

wrong

so why don't you write directly in binary?

I don't think that it's always important to have features like a dynamic array that's accessed with the array[i] syntax. I think it's fine to use a close enough feature like linked lists to group together a list of data.

en.wikipedia.org/wiki/Variable-length_array#C99

hmmmmm...


wrong

...