From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 6/6] gnu: Improve error reporting of the use-.*modules macros. Date: Sat, 11 Nov 2017 14:56:37 +0100 Message-ID: <87h8u0hqay.fsf@gnu.org> References: <87zi7xwvso.fsf_-_@gnu.org> <20171108130921.25202-1-ludo@gnu.org> <20171108130921.25202-7-ludo@gnu.org> <87d14po9mv.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDWH4-0002gp-Kx for guix-devel@gnu.org; Sat, 11 Nov 2017 08:56:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDWH3-0007zX-P5 for guix-devel@gnu.org; Sat, 11 Nov 2017 08:56:42 -0500 Received: from hera.aquilenet.fr ([2a01:474::1]:43196) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eDWH3-0007zE-IM for guix-devel@gnu.org; Sat, 11 Nov 2017 08:56:41 -0500 In-Reply-To: <87d14po9mv.fsf@gmail.com> (Chris Marusich's message of "Fri, 10 Nov 2017 18:02:32 -0800") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Chris Marusich Cc: guix-devel@gnu.org Heya, Chris Marusich skribis: > Ludovic Court=C3=A8s writes: > >> +(define-syntax-rule (try-use-modules hint modules ...) >> + (eval-when (expand load eval) >> + (%try-use-modules '(modules ...) >> + (source-properties->location >> + (current-source-location)) >> + hint))) >> + > > Why is it necessary to use eval-when here? The Guile manual makes it > sound like eval-when is intended to be used with syntax-case macros, not > syntax-rules macros. It=E2=80=99s necessary because =E2=80=98use-modules=E2=80=99 (and =E2=80=98= try-use-modules=E2=80=99 here) doesn=E2=80=99t allow you to specify the =E2=80=9Cphase=E2=80=9D (run-time = or expansion-time) at which you=E2=80=99re =E2=80=9Cusing=E2=80=9D the module. Thus, it assumes = you=E2=80=99re using it both at expansion-time and at run-time. The (gnu packages =E2=80=A6) modules happen to export a few macros, so it doesn=E2=80=99t work if you import them at run-time only. Ludo=E2=80=99.