4 ms·
No. An ML-style functor is well-designed and can be type checked at the site of definition. If C++ had functors I would be very happy, but functors are not "zer
by choeger 5y ago
No. An ML-style functor is well-designed and can be type checked at the site of definition. If C++ had functors I would be very happy, but functors are not "zero cost" abstractions..., maybe they can be in a compiler like MLton, though.
- tempodox 5y agoI was referring to the use case, not the implementation details. ML-style functors may not be zero-cost abstractions, but they are a way to implement polymorphism, just like C++ templates. You may be able to achieve that with a PPX rewriter, but I'd rather use a functor.