An attempt at a task macro.
This is not complete: need to resolve context references.
This commit is contained in:
parent
87f243b16a
commit
b7e4b9dc74
1 changed files with 10 additions and 1 deletions
|
@ -20,9 +20,18 @@
|
|||
(register task-register)
|
||||
(triggers task-triggers))
|
||||
|
||||
(define* (task description action #:key (register #f) (triggers '()))
|
||||
(define* (task% description action #:key (register #f) (triggers '()))
|
||||
(make-task description action register triggers))
|
||||
|
||||
(define-syntax task
|
||||
(syntax-rules ()
|
||||
((_ description (action arg ...) kwarg ...)
|
||||
(task%
|
||||
description
|
||||
(lambda (conn ctx)
|
||||
(action conn ctx (assoc-ref ctx arg) ...))
|
||||
kwarg ...))))
|
||||
|
||||
(define (run-task conn ctx task)
|
||||
(match task
|
||||
(($ <task> description action register triggers)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue