From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 0pSGLpdmsl/CfAAA0tVLHw (envelope-from ) for ; Mon, 16 Nov 2020 11:46:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MF/YKZdmsl/vEQAA1q6Kng (envelope-from ) for ; Mon, 16 Nov 2020 11:46:31 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3FC6E9402A5 for ; Mon, 16 Nov 2020 11:46:31 +0000 (UTC) Received: from localhost ([::1]:52104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kecxq-0001Pq-25 for larch@yhetil.org; Mon, 16 Nov 2020 06:46:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kecxR-0001PT-UL for guix-devel@gnu.org; Mon, 16 Nov 2020 06:46:05 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60716) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kecxR-0006MX-AH; Mon, 16 Nov 2020 06:46:05 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=47712 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kecxQ-0008HJ-Lr; Mon, 16 Nov 2020 06:46:05 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Danny Milosavljevic Subject: Re: Discoverability at the REPL level References: <86d00evkmr.fsf@gmail.com> <20201115154942.57e5f868@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 Brumaire an 229 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 16 Nov 2020 12:46:02 +0100 In-Reply-To: <20201115154942.57e5f868@scratchpost.org> (Danny Milosavljevic's message of "Sun, 15 Nov 2020 15:49:42 +0100") Message-ID: <873619zfr9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guix Devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: SGQLvXHRXYd7 Hi! Danny Milosavljevic skribis: > On Sun, 15 Nov 2020 14:02:04 +0100 > zimoun wrote: > >> In an ideal world, the first =E2=80=99,a=E2=80=99 could provide hint for= the module to >> =E2=80=99,use=E2=80=99 > > There is no "the" module. Any number of modules could have your searched= -for > symbol--and the procedures so found could do completely unrelated things.= One > of the points of using modules in the first place is in order to group to= gether > related things (and in order not to have unrelated things together). Yup. > What would be nice is for the module names to be easy to understand so yo= u know > which module to import. That's currently not great. For example I have = no > idea when something goes into (guix packages) vs (gnu packages). There=E2=80=99s a rationale: (guix =E2=80=A6) is for Guix-the-tool (the mec= hanisms) whereas (gnu =E2=80=A6) is for the distribution. Thus, =E2=80=98specification->package=E2=80=99, which browses (gnu packages =E2= =80=A6), is in (gnu packages). Module names are chosen to reflect the architecture of the code, so it can be opaque to a newcomer. I=E2=80=99m sure we can improve but there=E2= =80=99s necessarily that limitation. > Also, it would be nice and easy to implement to actually have the Guile R= EPL > search for all possible loadable modules that contain some symbol if it > encounters an unknown symbol, and print those, too (Guix often already do= es > that anyway!). > > It should be easy to add such a thing to the guile repl. In addition to > ",describe" and ",apropos" there would be ",search" which would loop thro= ugh > all modules, find the specified symbol and then print the docstrings of e= ach > of those, including the module to use for each. > > But since these modules can contain code that runs at module import time, > that's maybe also not what you want to actually happen (it would execute > code of random modules that are in the search path). > Then again, guile has declarative modules, too. If those don't do that, > maybe just search in those. > > Also, maybe you don't want Guile to actually IMPORT things into your name= space > when you do ",search". You just want guile to list them. That would be = the > only complication. Yeah the unbound-variable hint, for example, currently looks at already-loaded modules. Triggering extra loads could have undesirable side effects: I/O storm, increased memory usage, unwanted code executed, etc. Likewise, bindings, docstrings, etc. are all things that exist in a live Guile system. So searching them normally involves loading all the code, which is unreasonable. Now, .go files are ELF these days, and they contain docstrings and a symbol table. So one could implement a module search that parses ELF files, browses docstrings and symbols, thus without ever running code. Andy, if you read this, what are your thoughts? Thanks, Ludo=E2=80=99.