News for hackers. Stuff that matters.
Re:Why Rust closures are somewhat hard by coldtea on Monday September 10, 2018 @05:19PM (#17955300)
>But writing a doubly linked list was already shown to be difficult [1], and now closures are too ...

That's a very shallow concern. Writing a "doubly linked list" is what you do in Rust with unsafe or will several other ways. It's also not something you usually do, you just use one of the several implementations in the library and third party libraries and get on with your actual program.

And this doesn't show closures to be that hard at all. It's the basic dynamic vs statically typed language thing, plus a couple of caveats to keep in mind. Hardly anything to write home about.

The fact the tons of people use Rust for production code already, and love it, doesn't give these concerns pause?

Re:Why Rust closures are somewhat hard by rwmj on Monday September 10, 2018 @05:31PM (#17955386)
Surely the problems behind a doubly linked list apply to similar data structures (trees and graphs, notably - of which there are many more varieties than could be covered by a standard library). Writing a tree without resorting to unsafe seems like something which would be important.
Re:Why Rust closures are somewhat hard by amelius on Monday September 10, 2018 @05:36PM (#17955426)
Yes, for example a DOM tree where every node has a backlink to its parent.
Re:Why Rust closures are somewhat hard by bzbarsky on Tuesday September 11, 2018 @05:52PM (#17963719)
In a DOM tree, any live node in the tree needs to keep the entire tree alive.

Which means you either need some sort of garbage collection setup, or reference counting (with cycle collection), or some sort of indirection where you really hold references to a "tree + node" pair and then have to worry about what happens when a node moves from one tree to another. Or something else, other than just having a bunch of objects that all point to each other without any explicit ownership semantics...

Re:Why Rust closures are somewhat hard by TheCoelacanth on Monday September 10, 2018 @07:12PM (#17955923)
Considering that one of the largest and most prominent Rust projects (Servo) is a browser, that is obviously not an insurmountable problem.
Re:Why Rust closures are somewhat hard by pjmlp on Tuesday September 11, 2018 @04:56AM (#17958129)