From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esB7h-0000ag-7e for guix-patches@gnu.org; Sat, 03 Mar 2018 12:39:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esB7e-0006Ve-4G for guix-patches@gnu.org; Sat, 03 Mar 2018 12:39:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:35073) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esB7e-0006VY-1I for guix-patches@gnu.org; Sat, 03 Mar 2018 12:39:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1esB7d-0003AU-Rj for guix-patches@gnu.org; Sat, 03 Mar 2018 12:39:01 -0500 Subject: bug#30657: [PATCH] services: messaging: Prosody config supports file-like objects. Resent-To: guix-patches@gnu.org Resent-Message-ID: References: <87o9k6csz9.fsf@gnu.org> <20180303013308.12929-1-clement@lassieur.org> <87bmg5b4xu.fsf@gnu.org> From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: <87bmg5b4xu.fsf@gnu.org> Date: Sat, 03 Mar 2018 18:38:22 +0100 Message-ID: <87zi3pkqk1.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 30657-done@debbugs.gnu.org Ludovic Courtès writes: >> +(define (file-like? val) >> + (and (struct? val) ((@@ (guix gexp) lookup-compiler) val))) > > I’m not fond of the idea of using @@ in real code. :-) > > Could you move ‘file-like?’ to (guix gexp), with a docstring, and with > ‘->bool’ to avoid exposing internal details: > > (define (file-like? value) > (and (struct? value) (->bool (lookup-compiler value)))) > > ? I did it. >> +(define (file-object? val) >> + (or (file-like? val) (file-name? val))) > > Do we need this predicate? After all, all we can say is that a file > name is necessarily a string (or a string-valued gexp), but a string is > not necessarily a file name (IOW there’s no disjoint type for file > names.) > > I suppose the configuration mechanism needs it though, right? In that > context it’s probably OK. The problem is that the check happens when the user evaluates (prosody-configuration), which allow them to know right away about type errors, without running "guix system reconfigure". So the user doesn't even need a store. Plus, not everything should go to the store. For example, certificate keys shouldn't, as they are private. Thus, having both 'file-object?' and 'file-name?' makes sense to me. > Apart from this the patch LGTM, thank you! Pushed as bdcf0e6fd484a54240a98ddf8b6fa433c1b9bd6c, with the modifications you suggested. Thank you for the review! Clément