Jow Forums tells you rust is shit because of "le hipster community and only trannies use it"

>Jow Forums tells you rust is shit because of "le hipster community and only trannies use it"
meanwhile, you can ask a question on stack overflow and that guy Shepmaster will answer it within 5 minutes. you also dont have all of the bullshit and bloat that comes with c++ while having a simple yet effective compile tool (cargo) without the need for bullshit makefiles.

in this day and age, if your building a new project, all you need are -
>go
>rust
>javascript

Attached: Screenshot 2018-10-31 at 21.14.42.png (936x484, 163K)

Other urls found in this thread:

github.com/rust-lang/rust/issues/51245
github.com/rust-lang/rust/issues/43596
doc.rust-lang.org/rust-by-example/std_misc/process/pipe.html
words.steveklabnik.com/you-can-t-turn-off-the-borrow-checker-in-rust
twitter.com/SFWRedditGifs

Ok, Ill bite.
I'm and Ada developer for highly reliable systems, why should I use rust instead?

There is a reason that C++ programmers try and shoot down all new languages, because there is nothing about C++ that translates to normal programming. You can never really learn C++ because a language built on templates can never be learned but is more akin to a plate spinning circus act. Common features in C++ like strings and vectors have to be implemented in templates because the core language has to maintain compatibility with C. C++ programmers will shy away from the word templates and try and get people to use the word generics to give the idea that C++ is a metaprogramming language. What they won't tell you is that the purpose of meta programming is to make DSL's. Even a language like Lisp which is specifically designed for metaprogramming requires a bottom up style of programming that starts from primitives and grows up into its use case. You never hear Lisp programmings brag about using packages or libraries because pulling in someone elses metaprogramming structures goes against bottom up programming. Lisp programmers will also tell you overuse of macros is a recipe for disaster. C++ programmers on the other hand brag at how much libraries they use, in fact they have to use a hermetically sealed ecosystem of libraries because introducing external libraries into C++ quickly turns into a plumbing nightmare. There are a lot of C++ programmers on Jow Forums, mostly over 40 who have wasted their entire career on C++ and are useless for anything else. They throw words around like 'expressiveness' to give the illusion that C++ somehow provides extra capability over other languages when its really more of a case of the emperors new clothes.

There is nothing wrong with Ada, this thread is specifically aimed at C++ programmers. Ada is still a relevant language that can stand equal to new languages like Rust, Go, Swift, D, etc.

Ok, now write a doubly linked list without using unsafe. Such a beginner's textbook data structure should be a breeze, shouldn't it?

It all compiles to machine code. Write your own langauge; who gives a fuck.

There is nothing 'unsafe' about declaring something unsafe. unsafe just means allowing the type system to ignore things like bit strings, its isolated and does not introduce anything 'unsafe' into the rest of the code.

is this a copy pasta? because its fucking 100% correct
t. 35 year old who spent entire career with c++

no, I just wrote it now

Certainly, but having to use it in the course of totally normal and regular programming does leave the question why the languages only half-heartedly attempts to be safe without really succeeding very well, when the only effect left from it are superfluous roadblocks in the process of writing so-called "safe" code.

You're quick OP. Jow Forums always bashes languages that are actually useful.. Java, Go, Rust, C# etc.. JavaScript is gay though.

i didnt read first time because wall of text...
what you say sounds true tho

Shepmaster is based.

Attached: Screenshot_20181101-001022.jpg (767x216, 18K)

rust is for retarded who don't know how to write C

Is there anything major that has been written in Rust?

>rust is for retarded who

Attached: Screen Shot 2018-08-29 at 10.57.36.png (290x312, 53K)

Parity-ethereum

the difference between generics and macros is that the former can substitute types only. It's a spectrum.
Any statically typed language is useless without generics.
Modern C++ has only one major problem, and that's bad PR from stagnation that happened between C++98 and C++11. C++11 should have happened in 2004.
C++98 is shit today but most people know nothing else. Places that restrict c++ to bare minimum for retarded 'safety' are the worst.
Rust seems like new Java to me, a language designed for dumb coders that sacrifices expressiveness to prevent brainlets from hurting themselves, especially regarding mutable references.
Go is a fad like ruby was a few years ago, it's horrifically slow and doesn't even do parallelism good. No reason to use it over something else.

Anything that needs performance (especially multithreaded):
C++
Things that need to work in a browser:
Javascript
Expressiveness is more important than performance:
Python (except for controlling gpu, then there's no performance impact), lisps
You want a language that makes you feel smart just from writing in it:
Haskell, Idris

>go
>javascript
>rust

this was an ironic shitpost wasn't it?

Attached: 1232931963267.png (403x428, 103K)

how would you implement containers without templates is a statically typed language ?

Jow Forums hating on rust is an elaborate gatekeeping

Rust is actually the best modern language, shits all over go and c++. It's steadily picking up more steam, so if you get good at it now you are guaranteed to have a well paying job in 2-5 years in it.

this is a troll question, C++ is the ONLY language that relies on templates for core containers

I don't know much about programming. seriously wondering :^)

>Any statically typed language is useless without generics.
>C is useless

How do you do multithreaded programs in Rust without unsafe?

Attached: $.gif (250x251, 1002K)

How do you share data across multiple threads safely?

notice me senpai !

locks & mutex

Well lets come up with some situations.


a) Multi-threaded Application that DOES NOT share data between threads

b) Multi-threaded Application that shares data, but does so via a message queue based system with copies of the data

The first would be safe, yes?
The second can't be safe?

Attached: dumb crow.png (657x527, 51K)

Who uses Ada?

>a language is good because there's a gatekeeper you must be beholden to to answer any questions

check out D laddy
continually depresses me that none of my ni/g/s know about D

Hell no nigga. D used to get shilled all the time in previous years on Jow Forums and /prog/. Dead language, bad language.

Attached: 1442751535106.png (600x600, 51K)

hahaha I don't think so you frogposting failure

be nicer

Attached: 1433698243654.png (613x556, 29K)

It's a cyclic data-structure, something that Rust encourages against due to unclear ownership. It's not meant to be "safe", because it isn't.

Part of me wants to write an init system in Rust, but seeing shit like this makes you question if it is a real "systems" language.
github.com/rust-lang/rust/issues/51245
github.com/rust-lang/rust/issues/43596

>b) Multi-threaded Application that shares data, but does so via a message queue based system with copies of the data
this can be safe. this is what lifetimes and .clone() are for. also you have mutex with .lock()

It doesn't have the extensive static verification features of Ada like variable ranges but it does ensure memory-safety by tracking object ownership

Ada is used in scenarios such as avionics software in commercial airliners and military applications, essentially any scenario where failure due to programming errors would result in people getting killed

I have no idea how people can praise C macros let alone C++ templates with a straight face when Lisp macros still beat the shit out of them in terms of payoff for the amount of effort required

also when you create a new thread you have to "move" the value into the closure so it cant be accessed outside of the scope of the thread without passing it through a channel/stream

How safe is lifetimes though? Is it just reference counting? Also cloning data will kill performance in the long run won't it?

Can you share a simple example to compare to C or C++ or Java?

1) completely safe
2) no
3) depends on what you clone

>not using an actor model like actix to do multi threading

You're confusing a requirement that arises due to C++'s limitations with something that's inherently necessary to make a container hold objects of any type

Java's generics and Haskell's type hierarchy are two examples of what you're looking for

Cloning will always be safe and better than dealing with locks unless you're passing large data multiple of times, and at that point you should consider what you're doing because even locking should be used sparingly

>putting Rust next to shitlangs Go and JS
neck yourself OP
Go takes C, removes the most useful things about it, adds a garbage collector and a package manager. Its only use case is for the horde of copy-paste-from-stackoverflow "software developers" who can't understand C.
JS is a joke of a language that happened to be the only thing that could be used in a browser and on a server in 2008. Its community champions the exact brand of idiots that Go was created to compensate for.
Rust is an impressive feat of modern computer science. It does everything C++ does, but without the bloat. Its memory management is fully automatic, yet it has no garbage collector. Its concurrency is elegant both in syntax and in implementation. Instead of compensating for problems in the software industry like Go, or prizing convenience over quality like JavaScript, Rust solves real problems, and it enables the programmer to do the same.

>the difference between generics and macros is that the former can substitute types only. It's a spectrum.
That's not the only spectrum C++ is on
>C is a useless language
>C++ for concurrency when Rust exists
>modern C++ is anything short of a bloated mess of overlapping, half-baked, and contradictory features
>python is expressive, but rust isn't
I guess you're on the spectrum too

>Multi-threaded Application that shares data, but does so via a message queue based system with copies of the data
doc.rust-lang.org/rust-by-example/std_misc/process/pipe.html

Attached: ferris-pepe.jpg (350x300, 33K)

Copying data instead of sharing it across threads means you don't need to coordinate access to that data with locks, it's still somewhat case-by-case but avoiding situations where you need to use locks can help with both performance and maintainability

>because it isn't
>"doubly linked lists aren't safe"
Is this what rustfags actually believe? If this is the sentiment behind the language and its users, that's just more reason to stay away.

Rust has reference counters, Rc and Arc. Reference counting has runtime implications. Lifetimes are resolved at compile-time, and thus they have no runtime cost.

holy shit please stop
I like Rust but this is just retarded

Safety in rust means memory safety, including multithreaded environments. A naive doubly linked list is not thread-safe. This is not a hard concept to grasp.

sure.
fn main() {
let (insert, receive) = mpsc::channel(); //Creates a new channel to pass values
let s = String::from("hello");
thread::spawn(|| {
insert.send(s.clone()).unwrap(); //Send a clone of data into the channel
}); // || {} is just an anonymous function

//Create a second thread
thread::spawn(|| {
let ns = receive.recv().unwrap();
println!(ns); //"hello"
});
}

>A naive doubly linked list is not thread-safe.
Neither are hashtables, binary trees, heaps or managed vectors, so I guess Proper Rust Users should stay away from those too.

oh i forgot you have to have "move" before the user function.

>ask a question
If you need to ask questions instead of consulting the language docs and standard (which should be comprehensible at-a-glance), it's a bloated, shit language.
>bullshit makefiles
Makefiles allow you to do whatever you want. You don't even need to use Make, it's something called choice and freedom instead of an ecosystem imposed on you.
>go
>javascript
Python and C. You can trivially call any C code in Python, so that's that.

Can you show me a hashtable without unsafe?

A naive anything isn't necessarily memory safe. That's not the point of Rust. The point of Rust is that it forces proper, non-naive implementations of such data structures. The point isn't "theres no linked lists in Rust"

>Proper Rust Users
Sorry, I meant Rustacaeans. My bad. Didn't mean to hurt your feelings.

Attached: lol-18-2.png (305x330, 64K)

>language parrots "safety" buzzword
>standard library is written in unsafe code
>every single popular rust library is written in unsafe code
You literally can't do anything useful in Rust without bypassing its safety features. What a goddamn joke.

you can have thread safe heaps... thats what .clone() and .lock() is for. jfc have you even been reading the thread

>Makefiles allow you to do whatever you want. You don't even need to use Make, it's something called choice and freedom instead of an ecosystem imposed on you.
This so much. All the functionality subsumed by the compilter is one of the things I despise the most about all the nu-languages. A language that can't compile to standard object files isn't even worth considering.

It isn't thread-safe if two threads can step on each others' toes updating the heap.

If you lock a doubly-linked list, then it's perfectly thread-safe. What are you talking about.

Nobody is saying stay away from them, they're saying when implementing them there's more to worry about than just the bare naive implementation. There are perfectly usable implementations of data structures in the standard lib.

>they're saying when implementing them there's more to worry about than just the bare naive implementation.
So you're saying that you need unsafe to handle them? Then yes. See .

don't worry desu, other user is just retarded. Literally one of the first things I made in rust was a 100% safe binary tree.

You can't lock the whole thing at once, you have to either lock each node piecemeal or control access to the list through a wrapper object that can be locked easily

>control access to the list through a wrapper object that can be locked easily
I dunno about you, but in C, I can just allocate a mutex separately to the root pointer of the list without having "wrapper objects".

That's a cool job you have where all you do is implement data structures.

So your point is that it is only valid for programs to use pre-canned data structure implementation for vetted libraries? Fuck implementing a local variant of some common data structure to add some particular operation required for the task at hand, amirite?

s/implemetation/implementations/
s/for/from/

>cloning your data in and out of everything because it's unsafe otherwise

yikes, that is horrible for memory and cpu cache

it pretty much is, there's no reason to use C for anything. C++ is always better.
C is forced to emulate templates with void*
>Rust is an impressive feat of modern computer science. It does everything C++ does
Rust doesn't even have static function overloading, case closed.
>modern C++ is anything short of a bloated mess of overlapping, half-baked, and contradictory features
>it's too complex for me and makes me confused
thanks for confirming my Java impression about Rust.

>ambiguous replace
opinion dropped

No, my point is your claim about unsafe being a roadblock `in the course of totally normal and regular programming` is overblown.

>who cares, user, who has a computer with less than 32 gb ram anyway?
>if my notepad program uses 4 gb in return for being provably safe, isn't that the very definition of progress is programming?

>C++ is always better.
>doesn't even support pointers to compound literals

Attached: trash-2.png (367x538, 169K)

That's not what I meant. I meant the the borrow checker is an unnecessary roadblock in the course of totally normal and regular programming when you need to bypass it anyway every once in a while for totally normal needs.

>C++ is always better
lol, yes, if you consider ten times longer compile times a feature, C++ is the best thing ever.

Attached: a.jpg (600x500, 254K)

Name one thing you can't do efficiently in C++

Get a pointer to a compound literal.

the rust compiler makes guarantees about memory and thread safety for safe code, as static analysis is not perfect it gives you the option of using unsafe code for where you know you can implement something safely, or better yet, implement unsafe code *using a safe wrapper*, it is significantly easier to audit a rust program as a result because that >90-95% of your program written in safe rust isn't going to have undefined behaviour
>without bypassing its safety features
all unsafe rust lets you do is dereference a raw pointer, call unsafe functions, access or modify mutable static variables, or implement unsafe traits, unsafe rust is still subject to the borrow checker and other compile time checks for instance, you have to do a hell of a lot more than use unsafe blocks to disable safety features in rust

If you're always keeping track of the root pointer when you access a doubly-linked list, then that root pointer is essentially your wrapper.

Is spending twice the time writing totally normal code just to make the borrow-checker happy really worth spending an hour once a month on fixing a bug, though? I'm doubtful.

But your areas of potential unsafety are localized to a small region of your code, which is much easier to vet.

Also using unsafe doesn't directly bypass borrowck, as an aside:
words.steveklabnik.com/you-can-t-turn-off-the-borrow-checker-in-rust

Whenever when using a linked list would you not be keeping track of a root pointer? Is there even a theoretical case for this?

>doesn't even support pointers to compound literals
That doesn't make any sense, a compound literal is syntactic sugar for structure initialization. Outside of lisp macros you can't get a pointer to syntactic sugar.
It's also C99 only which makes it useless in practice, as almost every C project is ansi C.
Compile times are irrelevant, nobody is recompiling everything with each change.

>compile times

didn't know it was the 80s anymore

See .

>Compile times are irrelevant, nobody is recompiling everything with each change.
Not in C, indeed, but since 50+% of a C++ program lives in header files, it sure the case there.
My project taking 30 minutes instead of 3 to recompile sure does make a difference.

most people complaining about the borrow checker barely even understand why it's there, lifetimes being valid for the scope isn't a difficult concept to understand, gramps
refer to

Are you programming on a raspberry pi?

Yes? The whole point of a doubly-linked list is that you can efficiently traverse in any direction starting from any node. If you're always starting from the root node then what's the point of having a goddamn doubly-linked list?

>most people complaining about the borrow checker barely even understand why it's there, lifetimes being valid for the scope isn't a difficult concept to understand, gramps
Oh I totally understand why it's there and what it does. I'm just saying that, writing lots and lots of C code, I very seldom have the problems that it solves.

No, why? Have you never worked on a project larger than 1000 lines?

the borrow checker is easy to understand tho...

{
//a's lifetime starts
let a = 4;
//test_function(a) //lifetime ends here is uncommented
} //lifetime ends at end of scope unless returned into another variable

More commonly, the point of a doubly-linked list is to be able to very easily insert and, particularly, remove elements, while keeping the ability to (more seldomly) iterate through all of them.

It's not time spent bug-fixing that I'm worried about, what really troubles me are the bugs I don't know about.

>Not in C, indeed, but since 50+% of a C++ program lives in header files, it sure the case there.
Let me guess, boost and msvc?
You don't have to use boost, compile times without it (or similar heavy template library) are close to C.
>My project taking 30 minutes instead of 3 to recompile sure does make a difference.
Turn off link time optimization for development and make sure parallel compilation is enabled.