News for hackers. Stuff that matters.
Re:Learn Rust with entirely too many linked lists (2019) by saagarjha on Saturday February 22, 2020 @11:11AM (#22391686)
Kernel development is niche. Most of the time you don’t need linked lists.
Re:Learn Rust with entirely too many linked lists (2019) by varjag on Saturday February 22, 2020 @12:45PM (#22392228)
When all you have is Rust everything starts to look like adjustable array.
Re:Learn Rust with entirely too many linked lists (2019) by fluffy87 on Saturday February 22, 2020 @02:06PM (#22392667)
Rust has singly linked, double linked ( in its minimal std library) and intrusive linked lists - all with APIs that guarantee a lack of memory errors and data races at compiler. I don’t know any good kernel developer that wouldn’t like those guarantees and I work in the Linux kernel professionally full time.
Re:Learn Rust with entirely too many linked lists (2019) by saagarjha on Saturday February 22, 2020 @12:59PM (#22392311)
What’s an adjustable array? A vector?
Re:Learn Rust with entirely too many linked lists (2019) by varjag on Saturday February 22, 2020 @01:05PM (#22392341)
A vector is a one-dimensional array. Adjustable arrays can have arbitrary number of dimensions, although am not sure if it's a thing in Rust.
Re:Learn Rust with entirely too many linked lists (2019) by dpbriggs on Saturday February 22, 2020 @02:14PM (#22392721)
I've spent years programming rust and I'm not sure what you mean. Do you mean arrays of tuples, or nested arrays?
Re:Learn Rust with entirely too many linked lists (2019) by varjag on Saturday February 22, 2020 @02:16PM (#22392738)
I mean a multi-dimensional array.
Re:Learn Rust with entirely too many linked lists (2019) by dpbriggs on Saturday February 22, 2020 @03:24PM (#22393114)
Thanks! Why does everything look like a multi-dimensional array for you in rust?
Re:Learn Rust with entirely too many linked lists (2019) by varjag on Saturday February 22, 2020 @03:50PM (#22393235)
An array (an ADT) can be arbitrary dimensional, with one-dimensional case often called vector (and two-dimensional called matrix). An array can also be adjustable, both in one and multi-dimension variants.

So a vector can be both adjustable and non adjustable, and some language do have both versions. Some language have adjustable one-dimensional array/vector as the only dynamic aggregate/ordered datatype.

And to answer the post I replied to originally, a vector in rust is a one-dimensional adjustable array. To answer your question above, no that's not what I meant, sorry for not being clear enough from the beginning.

Re:Learn Rust with entirely too many linked lists (2019) by dpbriggs on Saturday February 22, 2020 @04:46PM (#22393543)
Thanks for clarifying.

I think we're just using different definitions. The only real definition of an array I've encountered in work and school is that it's just a one dimensional collection of elements, usually of static size. A vector depending on context is usually the same thing as an array but you conveniently change the size dynamically. Lists can whatever you need it to be given the context, just needs to be sequential.

Of course you can represent higher dimension structures by linearizing indices (x + row_size * y, etc).

I think people are getting confused as most don't consider arrays to be arbitrarily dimensional without some scheme.

Completely off topic but you've reminded me of this great article: https://hypirion.com/musings/understanding-persistent-vector...

Re:Learn Rust with entirely too many linked lists (2019) by staticassertion on Saturday February 22, 2020 @01:22PM (#22392434)
That just sounds like a graph.
Re:Learn Rust with entirely too many linked lists (2019) by varjag on Saturday February 22, 2020 @02:05PM (#22392664)
How in the heaven an array can sound like a graph?
Re:Learn Rust with entirely too many linked lists (2019) by staticassertion on Saturday February 22, 2020 @04:37PM (#22393506)
Sounds like one to me.