From 8f45e3292cfee0865e8374692bc4edfa9784b3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 30 Jul 2020 18:06:38 +0200 Subject: Simplify internal app interface. --- module/util/app.scm | 11 ++++------- 1 file 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 ...) -- cgit v1.2.3