Skip to content

Instantly share code, notes, and snippets.

@milessabin
Last active October 22, 2018 11:47
Show Gist options
  • Save milessabin/7308dc700b5f4717967492f5c7952964 to your computer and use it in GitHub Desktop.
Save milessabin/7308dc700b5f4717967492f5c7952964 to your computer and use it in GitHub Desktop.

Implicit Function Types

References

Comments

There was a single comment in the thread from Alexey Matveev, which pointed at three threads elsewhere,

  • Overlaps between implicit function types and Kotlin-style "receiver functions" for builder DSL patterns.
  • Relationship with potential replacements for DelayedInit.
  • An application of implicit function types to scope injection in DSLs.

The last of these describes an idiom which should be compatible with Dotty function types as they are now, and looks to be related to the requests in the previous two threads.

Editorial comments

We should try and collate idioms which this feature enables and evaluate their usefulness in areas where there are related open issues.

We need to ensure consistency with dependent and polymorphic function types.

Dependent Function Types

References

Comments

There was a short thread in response to Martin's aside "once we have dependent function types, of course one would like to have polymorphic function types as well." on mirroring method overloading in function types somehow.

Whilst that's largely orthogonal to implicit function types per se, the poster was asking for something similar to shapeless's polymorphic function values which we should ensure can be encoded smoothly using a combination of polymorphic, implicit and dependent function types in Scala 3.

Lack of further comments suggests either that the feature is uncontroversial, or that it's not sufficiently well understood to attract significant comment. My sense is that there is enough community interest in the feature and that if there were major issues some comment would have been made.

Editorial comments

We need to ensure consistency with implicit and polymorphic function types, and with related constructs, eg. constructors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment