News for hackers. Stuff that matters.
Re:Rust for Web by dikaiosune on Sunday January 31, 2016 @02:44PM (#11007689)
Does C++ have the ability to safely share stack data without copying? I don't think so, but I'm not an expert.

Rust has a few libraries that enable stack-scoped threads that are safe by virtue of ensuring that all threads created in the scope terminate before the data they reference is dropped (EDIT: and by preventing mutation of shared state without guarantees about atomic operations).

For example, I'm working on a project that uses crossbeam:

https://aturon.github.io/crossbeam-doc/crossbeam/

And there's a good blog post explaining some other things the library does:

https://aturon.github.io/blog/2015/08/27/epoch/

Re:Rust for Web by pcwalton on Sunday January 31, 2016 @04:35PM (#11008189)
> Does C++ have the ability to safely share stack data without copying? I don't think so, but I'm not an expert.

It does in the same sense that it's safe to do anything in C++. Virtually nothing in C++ is safe, but you can pretty easily do it.

Re:Rust for Web by zanny on Monday February 01, 2016 @12:13AM (#11009913)
Make the stack data const or wrap it in a mutex. That is what you end up having to do internally in Rust anyway, or being more sophisticated and having page locks.
Re:Rust for Web by steveklabnik on Monday February 01, 2016 @08:21AM (#11011546)
You can safely pass mutable pointers to stack data to scoped threads.
Re:Rust for Web by zanny on Monday February 01, 2016 @02:03PM (#11014339)
Which requires the language to perform some kind of synchronization around the data access or you will have races between threads.

Just because you don't have to be explicit about it doesn't mean you don't need to have some mechanism to handle it somewhere, its just automatic instead.

Re:Rust for Web by steveklabnik on Monday February 01, 2016 @02:54PM (#11014849)
It does not, actually, if you're accessing disjointed parts of your data: http://aturon.github.io/crossbeam-doc/crossbeam/struct.Scope...