[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] gnu: Add Kerberos client service.
From: |
Andy Wingo |
Subject: |
Re: [PATCH] gnu: Add Kerberos client service. |
Date: |
Wed, 30 Nov 2016 14:52:37 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
On Wed 30 Nov 2016 14:09, address@hidden (Ludovic Courtès) writes:
>> (define (validate-configuration config fields)
>> (for-each (lambda (field)
>> (let ((val ((configuration-field-getter field) config)))
>> - (unless ((configuration-field-predicate field) val)
>> + (unless (or (not val) ((configuration-field-predicate
>> field) val))
>> (configuration-field-error
>> (configuration-field-name field) val))))
>
> Here you’re assuming that when VAL is #f, it’s necessary invalid, an
> assumption that’s questionable and wasn’t made until now.
>
> Can you instead change your own field predicate to do that?
Agreed; the usual way to do this is to define the default value as a
sentinel value that your field predicate rejects. E.g.
(define unset-field (list 'unset-field))
You'd make the default value be `unset-field' (by reference). Then
assuming you defined a field of type "foo" then assuming you have an
associated predicate `foo?', you can do
(define (predicate/not-unset pred)
(lambda (x) (and (not (eq? x unset-field)) (pred x))))
(define foo? (predicate/not-unset foo?))
Andy
- Re: [PATCH] gnu: Add kerberos service., (continued)
- Re: [PATCH] gnu: Add kerberos service., John Darrington, 2016/11/18
- Re: [PATCH] gnu: Add kerberos service., Ludovic Courtès, 2016/11/18
- Re: [PATCH] gnu: Add kerberos service., John Darrington, 2016/11/19
- Re: [PATCH] gnu: Add kerberos service., Ludovic Courtès, 2016/11/21
- [PATCH] gnu: Add Kerberos client service., John Darrington, 2016/11/22
- Re: [PATCH] gnu: Add Kerberos client service., Ludovic Courtès, 2016/11/23
- [PATCH] gnu: Add Kerberos client service., John Darrington, 2016/11/29
- [PATCH] gnu: Add Kerberos client service., John Darrington, 2016/11/29
- Re: [PATCH] gnu: Add Kerberos client service., Ludovic Courtès, 2016/11/30
- Re: [PATCH] gnu: Add Kerberos client service., John Darrington, 2016/11/30
- Re: [PATCH] gnu: Add Kerberos client service.,
Andy Wingo <=