News for hackers. Stuff that matters.
Re:Choosing Nim out of a crowded market for systems programm... by moldavi on Saturday November 26, 2022 @01:25AM (#33750456)
It's not just doubly linked lists. They're just a basic example of borrow checking not being able to handle a lot of easy patterns that are perfectly safe in other languages.
Re:Choosing Nim out of a crowded market for systems programm... by cropcirclbureau on Saturday November 26, 2022 @02:31AM (#33750679)
Perfectly safe at the expense of a garbage collector. You can still do pointer soup and int handle based lists as you can do in any other low-level language with the same caveats. Rust is punching up from the manual memory management, zero-cost abstraction plane and competing with the garbage collected langs. It's still at it's core a tool for writing low level code.
Re:Choosing Nim out of a crowded market for systems programm... by moldavi on Saturday November 26, 2022 @02:37AM (#33750707)
GP was confused about why the doubly linked list case was so important, so I enlightened, it's an example of an entire class of the borrow checker's problems.

Your response isn't really relevant in that context, and instead escalates to a much larger debate, so best I not engage. Appreciate the thought though =)

Re:Choosing Nim out of a crowded market for systems programm... by pie_flavor on Saturday November 26, 2022 @03:22AM (#33750938)
The easy pattern of graph structures is handled by the easy implementation of adjacency lists, which is how you should have been implementing it in other languages too. The specific incompatibility is with the naïve hand-implementations of these structures; the specific thing Rust does not optimize for is toy code.
Re:Choosing Nim out of a crowded market for systems programm... by moldavi on Saturday November 26, 2022 @03:41AM (#33751053)
You know nothing of what I'm programming. You don't know when, whether, or how my program accesses or deletes data.

And yet, you proclaim that your solution is always the best in any language, in any situation.

It's particularly amusing because if we apply your solution everywhere, it reduces our entire program's state into basically a bunch of relational tables, which can be pretty awful for encapsulation, extensibility, and modularity in a lot of situations.

Re:Choosing Nim out of a crowded market for systems programm... by sph on Saturday November 26, 2022 @04:20AM (#33751240)
No need to take it personal. I don't think the "you" OP used referred to you specifically.
Re:Choosing Nim out of a crowded market for systems programm... by mumblemumble on Saturday November 26, 2022 @12:28PM (#33754671)
I agree with the sibling commenter that the parent poster was likely using the impersonal you. It is true that we don't know anything about you. You haven't volunteered any specifics, so we're kind of forced to guess if we want to try and respond in a productive manner.

To that end, I think that they chose a very good example. Abstractly, doubly linked lists are a special case of undirected graphs. So pointing out that a naive graph implementation is generally sup-optimal, and that usually one can more effectively model them using different data structures that Rust (and functional languages, and databases, and files, etc.) can handle just fine, neatly addresses problems that one might solve using a doubly linked list, as well as a whole host of other cases, in a single stroke.

Re:Choosing Nim out of a crowded market for systems programm... by zozbot234 on Saturday November 26, 2022 @08:30AM (#33752479)
These patterns are not "easy" at all - for one thing, they're non-compositional and anti-modular. They're exactly the kind of thing `unsafe {}` was intended for - though it would be nice if Rust came with a way of writing proofs of safety for these things, and this is a field of active research.
Re:Choosing Nim out of a crowded market for systems programm... by mumblemumble on Saturday November 26, 2022 @12:04PM (#33754395)
Fair, but, if so, could we focus on one of those instead?

I'd be especially interested to see an example that's perfectly safe in C or C++, and for which there's no better way of doing the data modeling in Rust. Using the kinds of data patterns that have long been used to avoid circular references in functional programming languages, for example. Because we want to avoid getting too caught up in examples of things that should be hard in Rust because Rust is designed to favor different ways of doing things.

Or, to put it cutely, I'd want to be cautious about doing the equivalent of criticizing a Toyota for having a terrible glide slope.