[-- Attachment #1: Type: text/plain, Size: 1019 bytes --] Interaction showing the problem $ guile GNU Guile 2.2.6 Copyright (C) 1995-2019 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)> (use-modules (system vm program)) scheme@(guile-user)> program-arities ERROR: Unbound variable: program-arities. ; should be defined Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user)> (arity:nreq +) ; 0 arguments required, correct $1 = 0 scheme@(guile-user)> (arity:rest? +) ; rest argument, correct $2 = #f scheme@(guile-user)> (arity:nreq car) ; 1 argument required, bad $3 = 0 scheme@(guile-user)> (program-arguments-alist car) ; correct $4 = ((required _) (optional) (keyword) (allow-other-keys? . #f) (rest . #f)) scheme@(guile-user)> The same thing happens in Guile 3, and on both Mac and Linux. [-- Attachment #2: Type: text/html, Size: 8540 bytes --]
Hi John! I can't explain why program-arities isn't defined, but I can tell that you're not using the arity:foo procedures the way they're meant to, because their definition indicates that one is supposed to pass them some sort of arity object that is represented as a list. The implementations use 'match' to destructure their argument and the values you're getting correspond to the "else" branch of the match since you provide procedures as arguments instead of lists. (One could say the lack of type-checking is a bug on its own right here.) We seem to have no way of getting an arity list of this sort since program-arities isn't defined. I suspect that some corresponding C code was removed at some point and the module (system vm program) accidentally left in place, as the Scheme code begins with: (load-extension (string-append "libguile-" (effective-version)) "scm_init_programs") scm_init_programs is from libguile/programs.c and indeed it doesn't define program-arities. Will investigate more tomorrow. -- Taylan
On 16.05.2021 02:07, Taylan Kammer wrote:
>
> Will investigate more tomorrow.
>
It seems that commit 1c33be992e8120abd20add8021e4d91d226f5b6a removed
much of the programs API at the C level but forgot to make the changes
to the corresponding Scheme module. (It was a big commit, part of
changing the whole VM implementation.)
I wonder if anyone really uses the program API. It might be best to
deprecate it in favor of an improved procedure metadata API.
--
Taylan