Skip to content

What is mask behind? #634

Answered by TimWhiting
osa1 asked this question in Q&A
Dec 21, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Hmm, I feel like it is a pretty good explanation, but let me try to explain it the same, with examples:

So let's consider multiple of the same effect on the stack. With simple masking we can skip a handler.

effect exn_
   fun throw_(e: string)

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")
  ...
  throw_("throw to inner")
  mask<exn_>
     throw_("throw to outer")

However let's say we want to override the outer handler (hide it from all code below the inner handler) - all throws must go through the inner to get to the outer. (In other words w…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@osa1
Comment options

@TimWhiting
Comment options

Answer selected by osa1
@TimWhiting
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants