Re:Memory Safe Languages in Android 13
by dahfizz on Thursday December 01, 2022 @03:29PM
(#33822259)
You make a good point that much of pythong stdlib is implemented in C. But you could implement python's list in pure python, safely. You can't implement something like that in rust without unsafe.
[ Parent
| on HN ]
You can implement lists in Rust safely; with enums, a list is four lines of safe code. You can even implement a doubly-linked list safely. You just can't do either of these things by wielding pointers willy-nilly. If you're willing to accept a performance tradeoff by implementing a list in pure, bootstrapped, FFI-free Python, then you can do the same in Rust.
Re:Memory Safe Languages in Android 13
by alserio on Thursday December 01, 2022 @03:58PM
(#33822612)
How would you implement a python list in python? I mean, what would you consider "acceptable" primitives to do so?
Re:Memory Safe Languages in Android 13
by burntsushi on Thursday December 01, 2022 @04:55PM
(#33823466)
You certainly can! And that's a good example, because it exposes just how important context is to this discussion. Perf matters in certain contexts. If you implemented a list in pure Python, do you think its users would find the overall perf of Python to be acceptable?