Major changes proposed for Extension Methods

Latest on the Dotty front: Martin has begun a draft PR to significantly rewrite the way Extension Methods work.

This is far from complete at this point; the most interesting bit is the rewrite of the documentation, which gives you a sense of the new design. I recommend reading through that. (The examples are all written using the new significant-spacing design, which I still find hard to read, but they make more sense when I mentally translate them to include the missing braces.)

My personal reaction is slightly mixed: the proposal removes the infix syntax for defining extension methods, which I thought was deliciously cool and intuitive. That said, though, the new proposal is rather less new-and-different than that was, so I suspect it will be easier to teach, and in general it’s pretty consistent, which is a plus. There is also some detail on how extension methods interact with implicit scope, which is worth keeping in mind.

Usual caveats apply: this is extremely early, not even a full PR yet. But it’s a pretty major change in the proposed design, so if you are trying to stay current with what Scala 3 may look like, it’s worth a look.

Lifelong programmer and software architect, specializing in online social tools and (nowadays) Scala. Architect of Querki (“leading the small data revolution”).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store