Removing program-arities export

Skyler via "Developers list for Guile, the GNU extensibility library" <[email protected]>
Newsgroups gmane.lisp.guile.devel
Message-ID <WZp-Z-HhbASpn9zmycHpyPermX68RQKZqs5PKrA0-UjcfEhjaZJm7Y6ZjMxsxVoUlUMMz60Eq3IYuOV3cc4CaGPVDiZfLtqpStMBHuRP1GQ=@protonmail.com>
Hello,

I am working on a patch for a bug I recently found in guile. The `program-arities` function is exported from the `(system vm program)` module and documented in the manual, but it is no longer defined (it was removed in commit 1c33be992e8120abd20add8021e4d91d226f5b6a).  It is only used in the `program-arity function`, which is not called anywhere in the Guile repository (and calling it with valid inputs results in an error due to the `program-arities` being undefined). See the shell session at the end of this email for details.

Removing those functions is simple, but the `arity:` accessors have more users, and since they're just pattern-matching on a list I'm concerned that they have been used for the new functions (eg, find-program-arity) so I'm not sure if it's safe to just remove them. In particular, `arity->arguments-alist` uses them unconditionally. However, `arity->arguments-alist` only has two callers, `program-arguments-alist` and `program-arguments-alists` (that's not a typo, the second one is pluralized), which call it conditionally. The conditions are different but both require that the given code passes the `primitive-code?` predicate. These functions are called from a few different places so it'll take a little more time to figure out if it's safe to remove them (or possibly just remove the logic conditioned by `primitive-code?`, if that is no longer in use, and leaving the rest of the function intact).

In solidarity,
Skyler

user@foreign-guix /d/shm> cat channels.scm
%default-channels

user@foreign-guix /d/shm> guix time-machine --channels=./channels.scm -- shell --container --nesting guile-next guile-readline
user@foreign-guix /dev/shm [env]$ guix describe
  guix 4a4a8c9
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 4a4a8c9d2621d4871c4b9c8857bfb0e6e53d7e56

user@foreign-guix /dev/shm [env]$ guile -q
GNU Guile 3.0.9-0.3b76a30
Copyright (C) 1995-2024 Free Software Foundation, Inc.
                                                                                                              
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
                                                                                   
Enter `,help' for help.
scheme@(guile-user)> (module-variable (resolve-module '(system vm program)) 'program-arities)
$1 = #<variable 734b7c40e940 value: #<undefined>>

scheme@(guile-user)> (use-modules (system vm program))
scheme@(guile-user)> (program-arity car #f)
ice-9/boot-9.scm:1676:22: In procedure raise-exception:
Unbound variable: program-arities

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.