From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:58358) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii3r1-0008N7-S5 for guix-patches@gnu.org; Thu, 19 Dec 2019 17:01:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii3qz-0005LT-Ph for guix-patches@gnu.org; Thu, 19 Dec 2019 17:01:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39657) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ii3qw-0005IK-Cp for guix-patches@gnu.org; Thu, 19 Dec 2019 17:01:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ii3qw-0005Ge-9W for guix-patches@gnu.org; Thu, 19 Dec 2019 17:01:02 -0500 Subject: [bug#38408] [PATCH v4 1/6] gnu: added new function, find-packages-by-name*/direct Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: Date: Thu, 19 Dec 2019 23:00:36 +0100 In-Reply-To: (Martin Becze's message of "Tue, 10 Dec 2019 14:23:38 -0500") Message-ID: <877e2sm0vv.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: Martin Becze Cc: 38408@debbugs.gnu.org Hello! I=E2=80=99m not a Crate expert so I=E2=80=99m only commenting on non-Crate-= specific bits. Martin Becze skribis: > * gnu/packages.scm (find-packages-by-naem*/direct) [...] > +(define* (fold-packages* proc init > + #:optional > + (modules (all-modules (%package-module-path) > + #:warn > + warn-about-load-error)) > + #:key (select? (negate hidden-package?))) > + "Call (PROC PACKAGE RESULT) for each available package defined in one = of > +MODULES that matches SELECT?, using INIT as the initial value of RESULT.= It > +is guaranteed to never traverse the same package twice." > + (fold-module-public-variables* (lambda (module symbol var result) > + (let ((object (variable-ref var))) > + (if (and (package? object) (select?= object)) > + (proc module symbol object res= ult) I=E2=80=99m wary of exposing variable names, especially in such a central A= PI. > +(define find-packages-by-name*/direct ;bypass the cache Providing an explicit cache bypassing method also sounds worrying to me: the cache is supposed to be transparent and semantics-preserving. More generally, I think adding new features to an importer shouldn=E2=80=99t require modifications in this area, as a matter of separating concerns. WDYT? Thanks, Ludo=E2=80=99.