Get the latest tech news
Higher RAII and the seven arcane uses of linear types
Can you spot the problem in each of these comments? // Remember to update the database row with the new status. // Remember to remove(&cache, entityRef) before you destroy the entity! // Remember to fulfill this promise with the result of the calculation.
Despite being shot and wounded by enemy fire, Cher Ami showed remarkable bravery and grit, delivering a crucial message that saved the lives of a trapped American battalion. The reason that regular RAII requires a zero-argument destructor is that an in-flight exception (or panic, or async task cancellation) will unwind the stack, destroying everything in its path. I want to give a huge thanks to Arthur Weagel, Kiril Mihaylov, Radek Miček, Geomitron, Chiuzon, Felix Scholz, Joseph Jaoudi, Luke Puchner-Hardman, Jonathan Zielinski, Albin Kocheril Chacko, Enrico Zschemisch, Svintooo, Tim Stack, Alon Zakai, Alec Newman, Sergey Davidoff, Ian (linuxy), Ivo Balbaert, Pierre Curto, Love Jesus, J. Ryan Stinnett, Cristian Dinu, and Florian Plattner(plus a very generous anonymous donor!)
Or read this on Hacker News