Subject: Re: [bug#30657] [PATCH 2/4] gexp: Add 'file-like?'.

From: [email-masked] (Ludovic Courtès)
Date: Sat, 03 Mar 2018 15:38:57 +0100

Clément Lassieur <[email-masked]> skribis:

> Ludovic Courtès <[email-masked]> writes:
>
>>> +(define (file-like? object)
>>> +  (or (local-file? object)
>>> +      (plain-file? object)
>>> +      (computed-file? object)
>>> +      (program-file? object)
>>> +      (scheme-file? object)
>>> +      (file-append? object)))
>>
>> This procedure would miss new types added with ‘define-gexp-compiler’.
>>
>> In fact I think you can simply write:
>>
>>   (define file-like? (@@ (guix gexp) lookup-compiler))
>>
>> Does that make sense?
>
> Yes it's great!  One also needs to check that it's a struct though.  I
> put it in (gnu services configuration).  Would it make sense to add the
> 'struct?' check in (guix gexp), or to add 'file-like?' there?

Yes, it makes sense to add ‘file-like?’ to (guix gexp) proper, as I
wrote in my other reply.

I was hoping we could avoid that, but I understand there’s a need for it.

Thanks,
Ludo’.