48 ms·
Code is docs. One can just infer lifetime by reading the code. (That said, having it encoded in the type system makes it many times easier)
by jenadine 2y ago
Code is docs.
One can just infer lifetime by reading the code.
(That said, having it encoded in the type system makes it many times easier)
- amluto 2y agoHave you actually looked at Linux device model code? Or filesystem code? Or most other code? Most is poorly documented. Most is overcomplicated. Quite a bit is flat-out wrong.
- p1necone 2y ago> One can just infer lifetime by reading the code. For trivial cases sure, for complex ones though this is akin to saying "you can know if there's any bugs by reading the code" which we all know is not true for any reasonable time investment put into reading the code.
- jsheard 2y agoAsahi Lina posted a thread about how difficult this actually is in practice: https://threadreaderapp.com/thread/1829852697107055047.html https://threadreaderapp.com/thread/1829852697107055047.html
- _dain_ 2y ago>One can just infer lifetime by reading the code. Enormously load-bearing "just" there. And if there's a subtle lifetime bug ... ?
- saagarjha 2y agoOne can just write correct code, of course.
- bluGill 2y agoSure you can, particularly in simple cases. However some code needs years to understand because something seemingly unrelated happening elsewhere changes things. The kernel often has to run on several different CPUs at the same time, and shouldn't sync the CPU caches if it is possible to avoid it.
- Tyrannosaur 2y agoPretty sure I can get close to mapping that to solving the halting problem