logoalt Hacker News

torginustoday at 11:52 AM1 replyview on HN

The gotcha is that this is a 90s C pattern, and software that actually needed this has been written for 3 decades by now


Replies

HarHarVeryFunnytoday at 3:12 PM

Sure, but this interface/implementation split is such a common pattern that it would be nice if the language handled it implicitly (NOT this std::indirect solution) rather than forcing the developer to use some explicit pimpl/handle pointer.

You'd essentially like to derive a class/module implementation from it's corresponding class/module interface (which is all the user sees), but have the language automatically add a hidden "pimpl" pointer to the interface class. The implementation would then essentially use "this" to access public members, and "pimpl" for private members.