Is it possible to implement the Abort capability using Scala 3.8 features?

Hi all,

A couple of years ago, when I decided to learn the absolute basics of Unison’s support for abilities (that’s how capabilities are called in the language) I wrote this deck (for the purposes of this email, if you are considering taking a look at it, please jump to slide 20, at least on a first reading):

In the deck, having realised the following

I took this Scala code

and translated it to this Unison code

I then modified the Unison code so that it implemented the optionality effect using an ability (algebraic effect) called Abort:

I am writing this email because on the one hand, I can’t wait to have a go at implementing the optionality effect using capabilities in Scala 3, but on the other hand, before I even consider doing that, I thought I’d ask you if Scala 3.8 already provides sufficient capability-related features to allow that, and if not, what are the future milestones that will see Scala 3 reach the point where it does.

Thank you in advance for any help you might be able to provide.

Philip

this sounds like a variant of CanThrow Capabilities with a fixed exception type

1 Like

You may also want to check out the implementation of boundary.break:

1 Like

Thank you @bishabosha and @bjornregnell for your suggestions.