Here’s a proposal to add implicit function types to Scala 3. An implicit function type
implicit A => B
is the logical first-class version of an implicit method
def m(implicit x: A): B
Here’s a link to the doc page.
I have already talked at length about the promises of implicit function types, for instance at POPL 2018 or at the D-language conference. In essence,
- they are a fundamental way of scope injection
- they promise to make many patterns of implicit parameters more concise
- they can replace the reader monad at a ~ 10x speedup.
For details I refer you to the talks.
This proposal is open for discussion in the community and will be discussed in our next SIP meeting, where we’ll take all your feedback into account for the approval/dismissal of this feature.
I think Implicit Function Types is a great thing.
But it seems that it does not suite for builder pattern in general.
I think you missed some details
For example we have two DSL for sql
We use JPA when we want to have object cash for example(low level api).
We use native SQL when we want to have full postgresql functionality for example.
Both DSL have similar grammar.
So we would not have any ability to use both DSL simultaneously if it was implemented by implicit function types.(see)
This topic was automatically closed after 27 days. New replies are no longer allowed.