2 ms·
You can statically analyze for leaks.
by dnautics 2mo ago
You can statically analyze for leaks.
- Panzerschrek 2mo agoBut with static analysis it's still possible to miss some leaks or to have false-positives. That's why an integrated language mechanism preventing such leaks is much better.
- dnautics 2mo agoYes, so you pick "false positives" instead of "missing some leaks" and you build a way to mark code as "unsafe". This is not fucking rocket science > That's why an integrated language mechanism preventing such leaks is much better. No categorical difference, except one is opt-in. You can even design your static analyzer so it analyses the code of dependencies that haven't opted in.
- estebank 2mo agoMaking things opt-in means that it will happen less often, making them opt-out that they will happen more often. In this case, on the one hand you have destructors that don't run when they should, and on the other you have destructors running at a more granular level than you'd want sometimes. I know which human failure mode I prefer.
- dnautics 2mo agoIn practice as long as you stick to using zig std, an analyzer can get quite far
- IshKebab 2mo agoI doubt that. I mean I'm sure it can catch some cases, but if it worked reliably it would just be a language feature.
- dnautics 2mo agoMaybe the authors just don't want to do it? Anyways: its possible, I am building it as a very side project. github.com/ityonemo/clr