emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#53663: closed ([PATCH] gnu: services: Also accept 'undefined in mayb


From: GNU bug Tracking System
Subject: bug#53663: closed ([PATCH] gnu: services: Also accept 'undefined in maybe-foo? constructs.)
Date: Wed, 02 Feb 2022 11:48:02 +0000

Your message dated Wed, 02 Feb 2022 11:47:02 +0000
with message-id 
<LZAnSJmgmdtLPRzpDhrfzSlilVJJq1MLXCWIIkE-yMLDeEXnFN5wPrWeMGAjZGo2vl1yUKPrilT3nCtusH9frolHVuqEM9boV1MLWgVr64U=@lendvai.name>
and subject line Fw: Re: bug#53663: [PATCH] gnu: services: Also accept 
'undefined in maybe-foo? constructs.
has caused the debbugs.gnu.org bug report #53663,
regarding [PATCH] gnu: services: Also accept 'undefined in maybe-foo? 
constructs.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
53663: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=53663
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] gnu: services: Also accept 'undefined in maybe-foo? constructs. Date: Mon, 31 Jan 2022 16:27:54 +0100
This is a temporary bandaid until a more explicit handling of maybe types is
introduced for configurations (e.g. by using srfi-189). Until then, with this
change it becomes possible to have definitions like:

(define-maybe string (no-serialization))

(define-configuration my-configuration
  (my-field (maybe-string))
  (no-serialization))

i.e. without providing a default value for MY-FIELD.
---
 gnu/services/configuration.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 0de350a4df..c5f276eab5 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -141,7 +141,9 @@ (define (define-maybe-helper serialize? prefix syn)
                                     (id #'stem #'serialize-maybe- #'stem))))
        #`(begin
            (define (maybe-stem? val)
-             (or (eq? val 'disabled) (stem? val)))
+             (or (eq? val 'disabled)
+                 (eq? val 'undefined)
+                 (stem? val)))
            #,@(if serialize?
                   (list #'(define (serialize-maybe-stem field-name val)
                             (if (stem? val)
-- 
2.34.0




--- End Message ---
--- Begin Message --- Subject: Fw: Re: bug#53663: [PATCH] gnu: services: Also accept 'undefined in maybe-foo? constructs. Date: Wed, 02 Feb 2022 11:47:02 +0000
> What would be different here?

the possibility of writing:

(define-configuration my-cfg
  (my-field (maybe-string)))

versus now having to write:

(define-configuration my-cfg
  (my-field (maybe-string 'disabled)))

but now that i thought about it, i think everyone is better off if i
deal with this on my side, instead of having a discussion about the
exact shape of a bandaid.

closing this for now; more later in the form of a proper cleanup
proposal of the configuration code.

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There can be no greater stretch of arbitrary power than is required to seize 
children from their parents, teach them whatever the authorities decree they 
shall be taught, and expropriate from the parents the funds to pay for the 
procedure.”
        — Isabel Paterson (1886–1961), 'The God of the Machine' (1943)



--- End Message ---

reply via email to

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