Re:Std::visit is everything wrong with modern C++ (2017)
by Silhouette on Saturday December 05, 2020 @11:45AM
(#25315870)
I respectfully disagree. Using tools provided by the standard library is common practice in any general purpose programming language. It just means that the algorithms you're implementing can concentrate on the novel aspects that provide additional value and not get bogged down with reinventing wheels for the basic implementation details.
Also, you seem to be suggesting that it's necessary to use unsafe code to implement these data structures in Rust. For something like the doubly-linked lists that were mentioned in an earlier comment, it usually suffices to use tools like Option and Rc for the links and to encapsulate the logic that manages those links inside functions like push_back and pop_back that you are surely defining to mutate your data structure anyway. Is there something specific you have in mind where this kind of strategy doesn't work and unsafe code is the only solution?
Re:Std::visit is everything wrong with modern C++ (2017)
by steveklabnik on Saturday December 05, 2020 @12:39PM
(#25316442)
Someone above suggests boot::intrusive. Do you also think that means C++ is a "glue language"?
I think the problem with this view is that Rust is not being used as a true programming language (like for implementing algorithms), but more as a "glue language".
If all the interesting stuff has to be done in libraries in "unsafe" mode, and all the uninteresting stuff (gluing) is done with borrow checking, then Rust is more a glue language. Which is fine. But don't call it a general purpose programming language.