guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: services: configuration: Change the value of the unset marker.


From: guix-commits
Subject: 02/03: services: configuration: Change the value of the unset marker.
Date: Thu, 25 Aug 2022 00:13:40 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit 6fb9759ef3b8eb2a2b10c3f02a57ece29b5c53ba
Author: Attila Lendvai <attila@lendvai.name>
AuthorDate: Wed Aug 24 14:40:42 2022 +0200

    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>
---
 gnu/services/configuration.scm   | 5 +++--
 gnu/services/messaging.scm       | 2 +-
 tests/services/configuration.scm | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 60965486a7..83da63c1b3 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -305,12 +305,13 @@ does not have a default value" field kind)))
 
 ;; Ideally this should be an implementation detail, but we export it
 ;; 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
 ;; that uses a default port, but the field can explicitly be unset to
 ;; request a random port at startup.
-(define %unset-value 'unset)
+(define %unset-value '%unset-marker%)
 
 (define (maybe-value-set? value)
   "Predicate to check whether a 'maybe' value was explicitly provided."
diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm
index 59cb486778..02712ede7c 100644
--- a/gnu/services/messaging.scm
+++ b/gnu/services/messaging.scm
@@ -95,7 +95,7 @@
                                  ;; doesn't interfere with
                                  ;; define-configuration and define-maybe
                                  ;; internals.
-                                 #''unset def))
+                                 #''%unset-marker% def))
                            #'(def ...) #'(target ...)))
                      ((new-doc ...)
                       (map (lambda (doc target)
diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm
index 8ed4ed4b66..4f8a74dc8a 100644
--- a/tests/services/configuration.scm
+++ b/tests/services/configuration.scm
@@ -150,7 +150,7 @@
   (protocol maybe-symbol ""))
 
 ;;; 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.
 (test-expect-fail 1)
 (test-equal "symbol maybe value serialization, unspecified"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]