Re:Can you trust a compiler to optimize your code?
by hfkwer on Tuesday August 01, 2023 @09:30PM
(#36965802)
What do you mean by the "type" of a function? It doesn't sound like you're using any kind of standard definition for the word.
Re:Can you trust a compiler to optimize your code?
by tialaramex on Wednesday August 02, 2023 @02:44PM
(#36975153)
A type. The same thing C++ does for a lambda, since you seem to understand C++ better.
Yes, the C++ type system doesn't express this, that's the defect (well, it's the consequence here of a larger defect).
Once they have different types there are two different interesting things we can do, we could just coerce them into a function pointer type based on the signature which is what you've seen in C++ and seem to assume is just naturally the only possibility. Or, we can use parametric polymorphism.