7 ms·
The Bunch API could easily include a function that takes a bunch and a function `t -> ()` that deallocates individual members, so that the logic is encapsulated
by zetalyrae 4y ago
The Bunch API could easily include a function that takes a bunch and a function `t -> ()` that deallocates individual members, so that the logic is encapsulated in a function. You have to pass the destructor function explicitly because the language doesn't know which function is the "canonical" destructor (and a type may have multiple destructors, i.e. multiple ways to end its lifecycle).
- tialaramex 4y agoSure, the idea of potentially having different ends to the lifecycle makes sense to me, same way constructors aren't a thing in Rust. And yes, I agree that this solves the problem, which was why I suggested it as one of three ways this could work if you look back up the thread. Not sure about how Austral can assure itself the Linear contractual obligations were discharged here, but I might be overthinking it.
- gpderetta 4y agoYes, it seems to me that the only difference is that destructors are called implicitly in c++/rust and explicitly in austral. I wonder if IDE support could help to get the best of both worlds: the IDE could automatically add the destructors call in code where needed, with an "automatically-generated" annotation that would allow to update and remove the calls as needed. I actually kind of like the idea. Similar things could be done for inference/type deduction. Possibly exceptions as well. The ide could also allow hiding the automatically generated blocks when you want to focus on the code isntead of the incidental bits. Probably these days new languages need to come with lsp-support out of the box, so that seems the best place to add the magic.