Snippet from Ma et al. "Lexical Effect Handlers, Directly": "Conventionally, effect handlers are dynamically scoped: when an effect is raised, the dynam- ically closest enclosing handler is chosen to handle the effect. But recent work has found that dynamic scoping threatens abstraction safety and makes it hard to reason modularly about effectful programs. In response to these challenges, lexical effect handlers have emerged as a promising design where effect handlers are lexically scoped."
https://cdn.masto.host/fduriansoftwarecom/media_attachments/files/113/368/975/829/426/260/original/42028cb2d57fc7a5.png