4 ms·
> Which is actually available in quite a few GC enabled languages. In existing implementations, not with Rust's static safety guarantees about dynamically allo
by catnaroek 9y ago
> Which is actually available in quite a few GC enabled languages.
In existing implementations, not with Rust's static safety guarantees about dynamically allocated resources, sorry. “Just provide some way to disable the garbage collector” raises some obvious (at least to me) questions that are nevertheless not addressed by the alternatives you usually propose:
(0) When does it make sense to disable the GC?
(1) How do we know we are using resources correctly by ourselves?
(2) How do we know we are cleaning up resources correctly by ourselves?
(3) How would you rigorously prove all of the above? (Yes, unlike most other programmers, I do prove my programs correct.)
- pjmlp 9y agoI have not written anywhere “Just provide some way to disable the garbage collector”, rather that they offer other ways of managing resources. In Modula-3 or D, as possible examples, a solution might be destructors or scope attributes. The only way to actually be 100% safe would be if everyone would be programming with formal logic, which still requires a lot of research to make it approachable by the average developer.
- catnaroek 9y ago> In Modula-3 or D, as as possible examples, a solution might be destructors or scope attributes. These still allow you to mismanage resources. > The only way to actually be 100% safe would be if everyone would be programming with formal logic, Indeed. In order to construct a correct program, you also need to construct the logical argument that establishes its correctness. So, yes, you have to use formal logic. > which still requires a lot of research to make it approachable by the average developer. s/research/education/ You raise the craftsman to the level the craft requires, not lower the craft to the level of an apprentice.
- pjmlp 9y ago> These still allow you to mismanage resources. True, I didn't say the solution was perfect, but it is good enough for most devs. > You raise the craftsman to the level the craft requires, not lower the craft to the level of an apprentice. Nice goal, but I doubt you would manage to achieve that to anyone doing enterprise CRUD apps, mobile apps, games, ... to bother one second to learn TLA+, Idris, Coq or similar, unless their jobs depend on it.
- catnaroek 9y agoThe original post to which you replied begins with: > As I said before, resource management is first and foremost a matter of correctness, so performance is neither here nor there. Your proposed alternatives, namely: > In Modula-3 or D, as possible examples, a solution might be destructors or scope attributes. merely offer automation, not verification. Automation without verification simply makes screw-ups harder to undo.