diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-30 18:06:38 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-30 18:06:38 +0200 |
commit | 8f45e3292cfee0865e8374692bc4edfa9784b3a9 (patch) | |
tree | bc86bc5878ad9c6dbc8641ff18d718801e600f8c | |
parent | vulgar fixups. (diff) | |
download | calp-8f45e3292cfee0865e8374692bc4edfa9784b3a9.tar.gz calp-8f45e3292cfee0865e8374692bc4edfa9784b3a9.tar.xz |
Simplify internal app interface.
Diffstat (limited to '')
-rw-r--r-- | module/util/app.scm | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/module/util/app.scm b/module/util/app.scm index 9c1876d0..65aed562 100644 --- a/module/util/app.scm +++ b/module/util/app.scm @@ -15,15 +15,14 @@ (define current-app (make-parameter (make-app))) (define-syntax (define-method stx) - (with-syntax ((app (datum->syntax stx 'app)) - (current-app (datum->syntax stx 'current-app))) + (with-syntax ((app (datum->syntax stx 'app))) (syntax-case stx () [(_ (name args ...) body ...) (let* ((pre post (break (lambda (s) (eqv? key: (syntax->datum s))) #'(args ...)))) #`(define*-public (name #,@pre #,@(if (null? post) '(key:) post) - (app (current-app))) + (app (current-app))) (parameterize ((current-app app)) body ...)))]))) @@ -35,10 +34,8 @@ (define-syntax setf% (syntax-rules () - [(_ field value) - (setf% (current-app) field value)] [(_ app field value) - (hashq-set! (get-ht app) field (delay value))])) + (hashq-set! (get-ht (current-app)) field (delay value))])) ;; TODO setting a field should invalidate the cache of all dependant ;; fields. Among other things allowing a full calendar reload by running @@ -47,7 +44,7 @@ (syntax-rules () ;; special case to use current app) [(_ key value) - (setf% key value)] + (setf (current-app) key value)] [(_ app) app] [(_ app key value rest ...) |