From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1es8JV-0006gN-FU for guix-patches@gnu.org; Sat, 03 Mar 2018 09:39:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1es8JS-00044M-AQ for guix-patches@gnu.org; Sat, 03 Mar 2018 09:39:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:34102) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1es8JS-00044G-7d for guix-patches@gnu.org; Sat, 03 Mar 2018 09:39:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1es8JS-0007MF-0J for guix-patches@gnu.org; Sat, 03 Mar 2018 09:39:02 -0500 Subject: [bug#30657] [PATCH 2/4] gexp: Add 'file-like?'. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180228222821.6195-1-clement@lassieur.org> <20180228222821.6195-2-clement@lassieur.org> <87sh9ictft.fsf@gnu.org> <874llylyq1.fsf@lassieur.org> Date: Sat, 03 Mar 2018 15:38:57 +0100 In-Reply-To: <874llylyq1.fsf@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Sat, 03 Mar 2018 02:44:22 +0100") Message-ID: <877eqtb4vy.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 30657@debbugs.gnu.org Cl=C3=A9ment Lassieur skribis: > Ludovic Court=C3=A8s 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 =E2=80=98define-gexp-comp= iler=E2=80=99. >> >> 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 =E2=80=98file-like?=E2=80=99 to (guix gexp) prop= er, as I wrote in my other reply. I was hoping we could avoid that, but I understand there=E2=80=99s a need f= or it. Thanks, Ludo=E2=80=99.