Update handlers to resolve context refs

This commit is contained in:
Ray Miller 2025-01-06 21:44:20 +00:00
parent b463a828be
commit 12c45b628c
Signed by: ray
GPG key ID: 043F786C4CD681B8
2 changed files with 12 additions and 5 deletions

View file

@ -16,11 +16,19 @@
(description handler-description)
(action handler-action))
(define* (handler description action)
(define* (handler% description action)
(make-handler description action))
(define (run-handler conn ctx handler)
(match handler
(define-syntax handler
(syntax-rules ()
((_ description (action arg ...))
(handler%
description
(lambda (ctx)
(action (resolve-context-refs ctx arg) ...))))))
(define (run-handler conn ctx h)
(match h
(($ <handler> description action)
(format #t "RUNNING HANDLER ~a~%" description)
(action conn ctx))))
((action ctx) conn))))

View file

@ -36,7 +36,6 @@
(match t
(($ <task> description action register triggers)
(format #t "RUNNING TASK ~a~%" description)
(pk 'action action)
(let ((result ((action ctx) conn)))
(when register
(register-context-var! ctx register result))