From: "Ludovic Courtès" <ludo@gnu.org>
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: Discoverability at the REPL level
Date: Mon, 16 Nov 2020 12:46:02 +0100 [thread overview]
Message-ID: <873619zfr9.fsf@gnu.org> (raw)
In-Reply-To: <20201115154942.57e5f868@scratchpost.org> (Danny Milosavljevic's message of "Sun, 15 Nov 2020 15:49:42 +0100")
Hi!
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> On Sun, 15 Nov 2020 14:02:04 +0100
> zimoun <zimon.toutoune@gmail.com> wrote:
>
>> In an ideal world, the first ’,a’ could provide hint for the module to
>> ’,use’
>
> 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 together
> 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 you 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’s a rationale: (guix …) is for Guix-the-tool (the mechanisms)
whereas (gnu …) is for the distribution. Thus,
‘specification->package’, which browses (gnu packages …), is in (gnu
packages).
Module names are chosen to reflect the architecture of the code, so it
can be opaque to a newcomer. I’m sure we can improve but there’s
necessarily that limitation.
> Also, it would be nice and easy to implement to actually have the Guile REPL
> search for all possible loadable modules that contain some symbol if it
> encounters an unknown symbol, and print those, too (Guix often already does
> 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 through
> all modules, find the specified symbol and then print the docstrings of each
> 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 namespace
> 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’.
next prev parent reply other threads:[~2020-11-16 11:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-15 13:02 Discoverability at the REPL level zimoun
2020-11-15 14:49 ` Danny Milosavljevic
2020-11-16 11:46 ` Ludovic Courtès [this message]
2020-11-16 14:03 ` Tobias Geerinckx-Rice
2020-11-16 14:47 ` zimoun
2020-11-16 14:21 ` Bengt Richter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873619zfr9.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=dannym@scratchpost.org \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).