Re:Criticizing Hare language approach for generic data struc...
by tialaramex on Wednesday May 04, 2022 @09:40AM
(#31260218)
My impression, although it was difficult to be sure, is that Hare's "slices" (or maybe arrays?) are actually vectors, in at least some cases.
It seems you can grow them by appending, so they aren't like Rust's slice which is non-owning or a typical array which can't grow.
I suspect a Linked List is actually almost never the right shape for a data structure in Hare, because you should just use these vectors to do that.
The two actual rationales for Linked List in the 21st century (other than "I was writing C and I don't know what I'm doing") are: 1. Concurrency, Lock Free and sometimes even Wait Free algorithms are practical for Linked List and the other costs pale into comparison on highly contended data structures and 2. I'm doing some serious acrobatics with huge lists, I constantly perform split/ merge operations and so those being cheap is crucial. Hare doesn't have concurrency, and nobody should attempt such acrobatics in a language this dangerous.
It seems you can grow them by appending, so they aren't like Rust's slice which is non-owning or a typical array which can't grow.
I suspect a Linked List is actually almost never the right shape for a data structure in Hare, because you should just use these vectors to do that.
The two actual rationales for Linked List in the 21st century (other than "I was writing C and I don't know what I'm doing") are: 1. Concurrency, Lock Free and sometimes even Wait Free algorithms are practical for Linked List and the other costs pale into comparison on highly contended data structures and 2. I'm doing some serious acrobatics with huge lists, I constantly perform split/ merge operations and so those being cheap is crucial. Hare doesn't have concurrency, and nobody should attempt such acrobatics in a language this dangerous.