GNU bug report logs - #40294
Documentation for arity procedures doesn't match behavior

Previous Next

Package: guile;

Reported by: John Cowan <cowan <at> ccil.org>

Date: Mon, 30 Mar 2020 02:36:07 UTC

Severity: minor

To reply to this bug, email your comments to 40294 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#40294; Package guile. (Mon, 30 Mar 2020 02:36:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Cowan <cowan <at> ccil.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 30 Mar 2020 02:36:07 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: John Cowan <cowan <at> ccil.org>
To: bug-guile <at> gnu.org
Subject: Documentation for arity procedures doesn't match behavior
Date: Sat, 28 Mar 2020 17:42:25 -0400
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#40294; Package guile. (Sun, 16 May 2021 00:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 40294 <at> debbugs.gnu.org (full text, mbox):

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: 40294 <at> debbugs.gnu.org, John Cowan <cowan <at> ccil.org>
Subject: Documentation for arity procedures doesn't match behavior
Date: Sun, 16 May 2021 02:07:02 +0200
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




Information forwarded to bug-guile <at> gnu.org:
bug#40294; Package guile. (Sun, 16 May 2021 15:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 40294 <at> debbugs.gnu.org (full text, mbox):

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: 40294 <at> debbugs.gnu.org, John Cowan <cowan <at> ccil.org>
Subject: Re: bug#40294: Documentation for arity procedures doesn't match
 behavior
Date: Sun, 16 May 2021 17:26:12 +0200
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




This bug report was last modified 4 years and 28 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.