Re:Show HN: Rust Implementation of Conway's Game of Life
by bsaul on Wednesday April 08, 2020 @08:11AM
(#22812199)
i didn't mean rust didn't have dynamic sized arrays, i even mentionned Vec in my comment.
I am indeed a beginner in rust, and i was surprised by the completely different syntax & types for arrays and Vec... I read about it afterward and get the reason for it, but that's the first time i encountered that peculiarity in a language..
Re:Show HN: Rust Implementation of Conway's Game of Life
by nindalf on Wednesday April 08, 2020 @08:57AM
(#22812481)
I think you were downvoted because your comment appeared to be making an incorrect assertion confidently, rather than asking a question.
> funny how rust doesn't seem to let you easily work with dynamically sized array
Could instead have been
> why did the author choose a hashmap?
Re:Show HN: Rust Implementation of Conway's Game of Life
by brundolf on Wednesday April 08, 2020 @10:46AM
(#22813391)
A Rust Vec is very similar, if I recall correctly, to a C++ vector. It can basically be used like a List but is implemented underneath as an automatically dynamically-sizing array.
Re:Show HN: Rust Implementation of Conway's Game of Life
by PudgePacket on Wednesday April 08, 2020 @10:47PM
(#22819339)
That's fair, many languages will only have Vecs, and will call them arrays, so it can cause confusion coming to Rust :)
Dynamically sized arrays have been in the standard library since day 1.
https://doc.rust-lang.org/stable/std/vec/struct.Vec.html