[libcxx-commits] [libcxx] [libc++] Add __pointer_int_pair (PR #94324)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 4 08:06:58 PDT 2024


EricWF wrote:

Can you point me to the code, in a PR or otherwise, that makes use of this code?

I don't think we should add code before we use it. My concern is that [You aren't going to need it (N
How do we know it's the right abstraction until we have a few places we can apply it in the code base _today_.

When in doubt, keep behaviors separate until enough common patterns emerge over time that justify the coupling. On a small scale, managing duplication can be simpler than resolving a premature abstraction’s complexity. In early stages of development, tolerate a little duplication and wait to abstract. [1](https://testing.googleblog.com/2024/05/dont-dry-your-code-prematurely.html)

Could we move forward implementing move_only_function, then after it's implemented, see what actually needs to be done?

This is not the only unused abstraction that's been committed to libc++ for move_only_function recently. When looking for the implementation of `move_only_function` I found `__small_buffer` which is similarly unused. For example, `__small_buffer` provides a alloc and dealloc function which use `operator new[]`, but shouldn't we be using an allocator like everywhere else in the library? Are we sure it's the right abstraction. 





https://github.com/llvm/llvm-project/pull/94324


More information about the libcxx-commits mailing list