小编rai*_*in1的帖子

如何使用动态变量和中止控制在方案中定义异常?

我无法使用动态范围的变量来实现异常(handleraise)abort.

这个问题来自阅读论文动态绑定的句法理论,第6节图7.

我所尝试的似乎正常工作,在try块中抛出异常,并在try块内的try块中抛出异常.

什么不能正常工作是从处理程序内部抛出异常.在这种情况下,它应该中止到下一次尝试阻塞.

您可以在球拍计划中看到我的作品,以及2个测试程序.test-1正在运行,test-2正在运行.

#lang racket

;; A Syntactic Theory of Dynamic Binding - Luc Moreau
;; https://link.springer.com/content/pdf/10.1007%2FBFb0030637.pdf

(require racket/control)

(define x_ed (make-parameter 'x_ed))

; NOTE: (abort ..) is the same as (shift k ..) where you don't use k
; NOTE: in (handle f M) we call f the handler and M the try block

; v1
;(define-syntax handle
;  (syntax-rules ()
;    ((handle f M)
;     (parameterize ((x_ed (lambda …
Run Code Online (Sandbox Code Playgroud)

theory scheme continuations exception racket

6
推荐指数
1
解决办法
85
查看次数

标签 统计

continuations ×1

exception ×1

racket ×1

scheme ×1

theory ×1