Hacker News new | past | comments | ask | show | jobs | submit login

It seems like you don’t consider requirements like ABI at all. There’s a reason for opaque handles (typeless pointers or integer handles).

When managing resources on separate memory, RAII is also rarely something you’d want. There are different memory management strategies and tight control over memory is very important.

Even if you implement your library in C++ you will need to expose a C API to be compatible with other languages. Not everyone uses C++.




> When managing resources on separate memory, RAII is also rarely something you’d want.

It's the opposite.

When managing resources in system memory, RAII is rarely something I’d want because malloc() is slow.

When managing resources on separate device, RAII is invaluable. These external resources often have API designed like bind/use/unbind, map/update/unmap and similar. You forget that one close/unbind/unmap and you violate your part of the contract i.e. anything may happen including crashes and memory leaks.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: