Re:Why I love Rust for tokenising and parsing
by smolder on Friday November 08, 2024 @05:04AM
(#42085698)
I think you missed something if you felt the borrow checker made things too hard. You can just copy and move on. Most languages do less efficient things anyway.
[ Parent
| on HN ]
Re:Why I love Rust for tokenising and parsing
by miningape on Friday November 08, 2024 @05:11AM
(#42085722)
Oh no, you're right - especially looking at my last few commits this is very much what some parts of the project became. And when I was looking at it I felt like I was throwing away so much of the goodness Rust provides and it really irritated me.
Looking at Primeys' comment he actually gave some really interesting suggestions on how to manage this without needing Rc / weak pointers or copying loads of dynamic memory all over the place. Instead you have a flat structure of copy-able elements, giving you better cache locality and a really easy way to work with them.