Function subtyping in requirement satisfaction #1623
dabrahams
started this conversation in
Language design
Replies: 1 comment 1 reply
-
I don't know if we want subtyping on function types but it is not necessarily the end of the world if we do. That being said, I think we should actually implement compiler-blessed conversions (😱) instead of using subtyping. AFAICT the question is relevant in two cases:
In both cases, we really really want some kind of flexibility. For example, the following has to work IMO:
The way I see that working is that we teach the compiler a bunch of ways in which it can create thin wrappers around functions during eta-expansion. We do the same for witness tables. |
Beta Was this translation helpful? Give feedback.
1 reply
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
This discussion is a placeholder for discussing whether and to what extent, things like the following should be legal
I suppose doing something like this would also imply subtyping of function types… I know we have a little subtyping already and I forget whether that's included.
I can see real problems with not supporting this in some form if we start doing things like rejecting
throws
on functions that can't throw or rejectingsink
on parameters that aren't consumed in the callee (or even warning of these things!)Beta Was this translation helpful? Give feedback.
All reactions