News for hackers. Stuff that matters.
Re:Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe S... by zozbot234 on Saturday June 13, 2020 @01:43PM (#23511144)
> GC can be treated like a backstop which helps to keep your application from exploding while you work on memory management, and then you can incrementally address heap alloc (aka latency) concerns with an application that actually runs (for a little while at least).

This is not a good approach in general. GC is only really needed in applications when working with data that's graph-like and potentially involves cycles of object references. A software project should be properly designed at the outset so that GC can be used in a "pluggable" way where it's strictly needed. Rust will probably enable this kind of use in the future, but other languages such as Go can already be used to comparable effect, seeing as they're generally limited to smaller pieces of code ("microservices") running in their own separate address space.

Re:Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe S... by jzoch on Saturday June 13, 2020 @01:53PM (#23511226)
There are already a couple gc libraries in rust. I wouldnt say Go is strictly "pluggable gc" since...well you can't get rid of the gc. You can try and keep it from doing meaningful work but thats quite different than "RAII managed memory with a fallback to a gc library that targets my particular use-case"

Fully agree with you that GC should be abstracted away and used for where it shines: cycles and graphs!

Re:Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe S... by lumost on Saturday June 13, 2020 @02:05PM (#23511313)
is there any pluggable GC libary in rust that is both correct and stable?
Re:Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe S... by loeg on Saturday June 13, 2020 @02:09PM (#23511353)
The only one I've heard of is Boehm GC. Is it not correct or stable? I do not have any experience or special knowledge of it myself.
Re:Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe S... by saagarjha on Saturday June 13, 2020 @02:33PM (#23511549)
Boehm is conservative, unfortunately.
Re:Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe S... by lumost on Saturday June 13, 2020 @02:04PM (#23511307)
There was some consideration for a formal library based rust GC back in 2018 such that one could write GC<CyclicDataType> and get the benefits of a GC such as

- Not leaking memory - Not invoking unsafe - Not angering the rust compiler

None of those efforts stabilized to my knowledge, and the libraries developed for this task all have experimental/research tags associated to them.

For better or worse all the guides for using rust strongly encourage avoidance of primitive cyclic structures such as doubly linked lists, graphs, and other structures in favor of statically allocated fixed size variants. Like golang's preference for map/list as the only primitive structures, this is a constraint that one can get used to for most problems. But it doesn't feel great that as a language there are basic algorithms and datastructures that can't be idiomatically coded in the language.

Re:Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe S... by steveklabnik on Saturday June 13, 2020 @02:22PM (#23511457)
There’s a new GC library released the other day https://blog.typingtheory.com/shredder-garbage-collection-as...

Still extremely new, of course, but has promise!

Re:Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe S... by gameswithgo on Saturday June 13, 2020 @02:13PM (#23511379)
You can already use reference counting when needed. Pretty close to what you are envisioning.