mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-24 03:29:40 -05:00
services: configuration: Change the value of the unset marker.
The new value of %unset-value sticks out more when something goes wrong, and is also more unique; i.e. easier to search for. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
parent
ee08277a70
commit
6fb9759ef3
3 changed files with 5 additions and 4 deletions
|
@ -305,12 +305,13 @@ (define serialize-package empty-serializer)
|
||||||
|
|
||||||
;; Ideally this should be an implementation detail, but we export it
|
;; Ideally this should be an implementation detail, but we export it
|
||||||
;; to provide a simpler API that enables unsetting a configuration
|
;; to provide a simpler API that enables unsetting a configuration
|
||||||
;; field that has a maybe type, but also a default value.
|
;; field that has a maybe type, but also a default value. We give it
|
||||||
|
;; a value that sticks out to the reader when something goes wrong.
|
||||||
;;
|
;;
|
||||||
;; An example use-case would be something like a network application
|
;; An example use-case would be something like a network application
|
||||||
;; that uses a default port, but the field can explicitly be unset to
|
;; that uses a default port, but the field can explicitly be unset to
|
||||||
;; request a random port at startup.
|
;; request a random port at startup.
|
||||||
(define %unset-value 'unset)
|
(define %unset-value '%unset-marker%)
|
||||||
|
|
||||||
(define (maybe-value-set? value)
|
(define (maybe-value-set? value)
|
||||||
"Predicate to check whether a 'maybe' value was explicitly provided."
|
"Predicate to check whether a 'maybe' value was explicitly provided."
|
||||||
|
|
|
@ -95,7 +95,7 @@ (define (make-pred arg)
|
||||||
;; doesn't interfere with
|
;; doesn't interfere with
|
||||||
;; define-configuration and define-maybe
|
;; define-configuration and define-maybe
|
||||||
;; internals.
|
;; internals.
|
||||||
#''unset def))
|
#''%unset-marker% def))
|
||||||
#'(def ...) #'(target ...)))
|
#'(def ...) #'(target ...)))
|
||||||
((new-doc ...)
|
((new-doc ...)
|
||||||
(map (lambda (doc target)
|
(map (lambda (doc target)
|
||||||
|
|
|
@ -150,7 +150,7 @@ (define-configuration config-with-maybe-symbol
|
||||||
(protocol maybe-symbol ""))
|
(protocol maybe-symbol ""))
|
||||||
|
|
||||||
;;; Maybe symbol values are currently seen as serializable, because the
|
;;; Maybe symbol values are currently seen as serializable, because the
|
||||||
;;; unspecified value is 'unset, which is a symbol itself.
|
;;; unspecified value is '%unset-marker%, which is a symbol itself.
|
||||||
;;; TODO: Remove expected fail marker after resolution.
|
;;; TODO: Remove expected fail marker after resolution.
|
||||||
(test-expect-fail 1)
|
(test-expect-fail 1)
|
||||||
(test-equal "symbol maybe value serialization, unspecified"
|
(test-equal "symbol maybe value serialization, unspecified"
|
||||||
|
|
Loading…
Reference in a new issue