4 ms·
If you have posters of Adele Goldberg and Alan Kay in your bedroom, your bedsheets have the Smalltalk spec printed on them, you make an offering to the church o
by GuiA 11y ago
If you have posters of Adele Goldberg and Alan Kay in your bedroom, your bedsheets have the Smalltalk spec printed on them, you make an offering to the church of OOP every morning, and you want to push things to the max, you can do that by modeling all your functions as objects and implementing the doing/undoing in the constructor/destructor :3
(I do not advise actually doing this for anything besides being silly on HN)
- deleted 11y ago[deleted]
- tdicola 11y agoThis is actually a very well known best practice in C++, so common that it has an acronynm RAII: https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initia...
- GuiA 11y agoSure, but you probably shouldn't model the power function as an object (and philosophically, the point of RAII is resource management, not getting function inverses).