Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is mask behind necessary? #635

Open
TimWhiting opened this issue Dec 21, 2024 · 0 comments
Open

Is mask behind necessary? #635

TimWhiting opened this issue Dec 21, 2024 · 0 comments

Comments

@TimWhiting
Copy link
Collaborator

TimWhiting commented Dec 21, 2024

This is more of a question: not a bug!!

Consider the following code:

effect final ctl throw_(e: string): a

fun main()
  with handler
    fun throw_(e: string)
      println("Error in outer")
  with handler
    fun throw_(e2: string)
      println("Error in inner")
      throw_("from inner to outer") 
  with mask behind<exn_>
  ...
  throw_("throw to inner")
  mask<exn_>
    // Error
     throw_("throw to outer")

What if instead of mask behind we desugared overrides like this:

fun main()
  with handler
    fun throw_(e: string)
      println("Error in outer")
  fun throw-fn(e2: string, evv: evv)
     println("Error in inner")
     throw_("from inner to outer") 
  val evv = current-evidence-vector
  with mask<exn_>
  with handler
    fun throw_(s) throw-fn(s, evv)
  ...
  throw_("throw to inner") 
  mask<exn_>
    // Error
     throw_("throw to outer")

I guess the motivation for keeping mask behind is that it allows for the user to do overriding themselves, or to use it in other contexts. It adds expressive power. So maybe I've answered my own question - it isn't necessary for overrides, but adds expressive power that could allow the developer to make this and other safe evidence adjustments. The desugaring I show here is correct with respect to overriding, but exposes low level adjustments that are not type-safe - so it isn't a true user-accessible desugaring that they could write out themselves in a type-safe manner, just a compiler transform.

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

No branches or pull requests

1 participant