3 ms·
C++ is an extremely mainstream language that can write a fully general version of compose with variable arguments. https://godbolt.org/z/h7n8Y7qf1 https://godb
by skrimp 5y ago
C++ is an extremely mainstream language that can write a fully general version of compose with variable arguments.
https://godbolt.org/z/h7n8Y7qf1 https://godbolt.org/z/h7n8Y7qf1
Like sure, you can't write out a type for the entire overload set. Overload sets don't have types, but functions do. However, I don't think you'd ever actually want to write out the type of the compose function. Instead, I think it would be more reasonable to request that every intermediate function call is type-checked with fully specified types. In C++ this is the case.
- Matheus28 5y agoGreat implementation of what the parent comment asked. Not only that, but the compiler managed remove all the abstractions. (very minor nitpick: I'd pick `auto&& x` over `auto x`)