unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Discoverability at the REPL level
@ 2020-11-15 13:02 zimoun
  2020-11-15 14:49 ` Danny Milosavljevic
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: zimoun @ 2020-11-15 13:02 UTC (permalink / raw)
  To: Guix Devel

Dear,

Preparing the online Guix Days, maybe this discussion is worth.  It
echoes first with the talks “Guix compared to Nix” then with the recent
discussion about Emacs-Guix [1].


The topic is discoverability at the REPL level.


Well, I have a proposal draft «“guix repl” and beyond» that I never
sent, where the ideas was to discuss ’~/.guile’ and how to extend Guix
ending with these questions:

 1. Does Guix want a system of aliases?  For example, let the script
 “~/.config/guix/scripts/foo.scm“ and then ‘guix foo’.

 2. How could the API be more discoverable?

 3. Is the experimental ‘guix repl --gui’ reasonable?


The #1 popup’ed up in #38529 [2,3] and it is not related to
discoverablity but not orthogonal either.

The #3 means open Guile-Studio or any other front-end and echoes the
recent discussion about GUI front-end [4].


Therefore, here materials about the point #2. :-)


(The attentive reader is waiting for parametrized package PoC :-) and a
first discussion and arguments are this long thread [5].)


Feed back and ideas welcome.  Especially about:

        There are probably several ways to address it, including the
        unbound-variable hints and documentation.


All the best,
simon


1: https://yhetil.org/guix-devel/87tuttci4z.fsf_-_@gnu.org
2: https://yhetil.org/guix-bugs/87y2jie1aj.fsf@gmail.com/
3: http://issues.guix.gnu.org/issue/38529#60
4: https://yhetil.org/guix-devel/CAF-xJgsynM3KSzuM__f9dSPUC0epJ2QKdFwDftiLhTTuMfaTxw@mail.gmail.com
5: https://yhetil.org/guix-devel/87woitz1xx.fsf@gnu.org/

-------------------- Start of forwarded message --------------------
From: zimoun <zimon.toutoune@gmail.com>
Cc: guix-days@gnu.org
Date: Fri, 13 Nov 2020 19:20:21 +0100

Hi Ludo,

On Mon, 09 Nov 2020 at 22:55, Ludovic Courtès <ludo@gnu.org> wrote:

> Yeah I was also unsure; my idea was to give possible directions I had in
> mind (hence the plural: “the ways forward”), with the understanding that
> it’s nothing but a personal choice.

At «apero» break today, I have just watched [1] (speed 1.5) about Nix
modules (I do not know if it makes sense in the Guix context, anyway).
From my opinion, one interesting point is discoverability.

Guile is still a bit mysterious to me but a lot of tooling could be done
in this area.  For example, I am directly grepping in the Guix sources
to find the function names or which module provides which function, etc.
When you come from Python or Haskell (to name the few I know), the
experience is poor.  Even if Emacs+Geiser+Completion helps.

For a concrete example of annoyance,

--8<---------------cut here---------------start------------->8---
$ guix repl
scheme@(guix-user)> ,a fold-packages
scheme@(guix-user)> ,use(gnu packages)
scheme@(guix-user)> ,a fold-packages
(gnu packages): fold-packages	#<procedure fold-packages (proc init #:optional modules #:key select?)>
scheme@(guix-user)> ,d fold-packages
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.
--8<---------------cut here---------------end--------------->8---

So I have to know beforehand the module to import (and I personally do
not know how to list all the functions that the module exports) then use
,apropos and ,describe to know the signature and if it is what I want.

In an ideal world, the first ’,a’ could provide hint for the module to
’,use’ and the ’,d’ should provide both signature and docstring. Since
the naming is more or less regular ’,a package bag’ should list all the
functions containing (name or docstring) the both terms so it becomes
easy to find which module provide ’package->bag’.  Instead on relying to
ag+Ivy. ;-)


Well, just sharing random ideas that popped up watching [1]. :-)

1: <https://youtu.be/7sQa04olUA0?t=5183>


Cheers,
simon
-------------------- End of forwarded message --------------------

-------------------- Start of forwarded message --------------------
From: Ludovic Courtès <ludo@gnu.org>
Cc: guix-days@gnu.org
Date: Sun, 15 Nov 2020 12:25:29 +0100

Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> At «apero» break today, I have just watched [1] (speed 1.5) about Nix
> modules (I do not know if it makes sense in the Guix context, anyway).
> From my opinion, one interesting point is discoverability.

I think some of the criticism that applies to Nix does not apply to
Guix: we have ‘guix search’ and ‘guix system search’, we have package
transformation options (which achieve some of what people want to do
with Nixpkgs overlays), source code location shows up in search results,
etc.

Representing packages as functions is Nixpkgs is the root of
non-discoverability.  Conversely, packages, service types, etc. are
top-level declarations.

And… we have Guile modules when it comes to structuring code.  :-)

What we’re seeing here is an example of a DSL that grows and grows until
it includes all the features that general-purpose languages have.

What we don’t have yet is parameterized packages, but that motivates me
to come up with a PoC.

> Guile is still a bit mysterious to me but a lot of tooling could be done
> in this area.  For example, I am directly grepping in the Guix sources
> to find the function names or which module provides which function, etc.
> When you come from Python or Haskell (to name the few I know), the
> experience is poor.  Even if Emacs+Geiser+Completion helps.
>
> For a concrete example of annoyance,
>
> $ guix repl
> scheme@(guix-user)> ,a fold-packages
> scheme@(guix-user)> ,use(gnu packages)
> scheme@(guix-user)> ,a fold-packages
> (gnu packages): fold-packages	#<procedure fold-packages (proc init #:optional modules #:key select?)>
> scheme@(guix-user)> ,d fold-packages
> 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.
>
> So I have to know beforehand the module to import (and I personally do
> not know how to list all the functions that the module exports) then use
> ,apropos and ,describe to know the signature and if it is what I want.
>
> In an ideal world, the first ’,a’ could provide hint for the module to
> ’,use’ and the ’,d’ should provide both signature and docstring. Since
> the naming is more or less regular ’,a package bag’ should list all the
> functions containing (name or docstring) the both terms so it becomes
> easy to find which module provide ’package->bag’.  Instead on relying to
> ag+Ivy. ;-)

Yes, but you’re talking about API discovery here, which is different
from discoverability for package options from the CLI.

There are probably several ways to address it, including the
unbound-variable hints and documentation.

Perhaps worth discussing on guix-devel!  (You can share this message if
you want.)

Ludo’.
-------------------- End of forwarded message --------------------



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-16 14:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-11-16 14:03 ` Tobias Geerinckx-Rice
2020-11-16 14:47   ` zimoun
2020-11-16 14:21 ` Bengt Richter

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).