diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-03-31 16:46:02 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-03-31 16:46:02 +0200 |
commit | 35a413167e323f8b0c9ea40fe7599ffb50e9e321 (patch) | |
tree | 9b00917547b4a3e756aab29543fbb6574e0f7788 /module/parameters.scm | |
parent | Fix IPv6 binding for server. (diff) | |
download | calp-35a413167e323f8b0c9ea40fe7599ffb50e9e321.tar.gz calp-35a413167e323f8b0c9ea40fe7599ffb50e9e321.tar.xz |
Attempt at decentralized configuration system.
Placing all possible configuration items in a central (parameters)
module scales really badly. This idea that any module can register
configuration parameters is better. The current implementation however
has the drawback that it requires that the module exposing the parameter
is loaded before the value can be sat, but that scales even worse.
A probable solution would be to abandon binding everything to guile's
module system, and instead let (util config) provide a `conf-ref' and a
`conf-set!' procedures.
A `define-configuration' similar to emacs `defcustom' could be of use,
mainly for retroactively type checking parameters.
Diffstat (limited to 'module/parameters.scm')
-rw-r--r-- | module/parameters.scm | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/module/parameters.scm b/module/parameters.scm deleted file mode 100644 index d58c6333..00000000 --- a/module/parameters.scm +++ /dev/null @@ -1,33 +0,0 @@ -;;; Commentary: - -;; This file should define all global configurable variables which -;; doesn't belong anywhere else. The config module should then import -;; this module, and set all configs as needed. The config module -;; should also be able to set configs gotten from other parts. - -;;; Code: - -(define-module (parameters)) - -(define (ensure pred?) - (lambda (v) - (unless (pred? v) - (error (format #f "Value [~s] doesn't satisfy condition ~a" - v (or (procedure-name pred?) "")))) - v)) - -(define-public calendar-files - (make-parameter - '() (ensure list?))) - -(define-public summary-filter - (make-parameter (lambda (_ a) a) (ensure procedure?))) - -;; ev x str -> sxml -(define-public description-filter - (make-parameter (lambda (_ a) a) (ensure procedure?))) - -(use-modules (datetime util)) - -(define-public week-start - (make-parameter sun (ensure (lambda (x) (<= sun x sat))))) |