| ▲ | goku12 4 hours ago | |
I'm curious about the exact exchange that prompted the author to say this. > refuse to admit there are alternatives to RAII I'm even more curious about this. Can the author or anybody else explain what this means specifically? Can anybody list those alternatives other than GC and RC? PS: Computer Science isn't exactly my primary professional competence. | ||
| ▲ | cwood-sdf 2 hours ago | parent [-] | |
Batching/arenas can get you very far. If you adopt the zig/c object model as “things that have data” most destructors become useless. Resource management also can be accomplished at the batch level (eg you can free a bunch of fd’s all at once with a management layer rather than having each File object implicitly manage its own fd). For memory management, i believe proper use of arenas and batching tends to be faster than each object managing its own memory but idrk tbh. What the author is saying is that you dont have to have raii, you can use approaches like the one i described and they can still be pretty safe if you know what youre doing, but rust’s model basically prevents this if youre using rust idiomatically | ||