From: Mike Gran <spk121@yahoo.com>
To: 23821@debbugs.gnu.org
Subject: bug#23821: Misleading error for optargs
Date: Wed, 22 Jun 2016 05:03:59 +0000 (UTC) [thread overview]
Message-ID: <738648054.2214015.1466571839142.JavaMail.yahoo@mail.yahoo.com> (raw)
In-Reply-To: 738648054.2214015.1466571839142.JavaMail.yahoo.ref@mail.yahoo.com
The following program returns a confusing error with guile 2.0.11
(use-modules (ice-9 optargs))
(define* (func A #:key B)
#t)
(func 1 2)
When run with auto-compilation on, it gives a valid warning during the compilation
step but returns a confusing warning at runtime.
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/mike/Projects/pip-tui/pip-tui/bug.scm
;;; /home/mike/Projects/pip-tui/pip-tui/bug.scm:6:0: warning: wrong number of arguments to `func'
;;; compiled /home/mike/.cache/guile/ccache/2.0-LE-8-2.0/home/mike/Projects/pip-tui/pip-tui/bug.scm.go
Backtrace:
In ice-9/boot-9.scm:
157: 7 [catch #t #<catch-closure 56422c2dade0> ...]
In unknown file:
?: 6 [apply-smob/1 #<catch-closure 56422c2dade0>]
In ice-9/boot-9.scm:
63: 5 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
432: 4 [eval # #]
In ice-9/boot-9.scm:
2401: 3 [save-module-excursion #<procedure 56422c2f6a00 at ice-9/boot-9.scm:4045:3 ()>]
4052: 2 [#<procedure 56422c2f6a00 at ice-9/boot-9.scm:4045:3 ()>]
In unknown file:
?: 1 [load-compiled/vm "/home/mike/.cache/guile/ccache/2.0-LE-8-2.0/home/mike/Projects/pip-tui/pip-tui/bug.scm.go"]
In /home/mike/Projects/pip-tui/pip-tui/bug.scm:
3: 0 [func 1 #<undefined> 2]
/home/mike/Projects/pip-tui/pip-tui/bug.scm:3:0: In procedure func:
/home/mike/Projects/pip-tui/pip-tui/bug.scm:3:0: Error while printing exception
When run with GUILE_AUTO_COMPILE=0 it returns an intelligible warning:
Backtrace:
In ice-9/boot-9.scm:
157: 9 [catch #t #<catch-closure 560f68600020> ...]
In unknown file:
?: 8 [apply-smob/1 #<catch-closure 560f68600020>]
In ice-9/boot-9.scm:
63: 7 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
432: 6 [eval # #]
In ice-9/boot-9.scm:
2401: 5 [save-module-excursion #<procedure 560f68620a00 at ice-9/boot-9.scm:4045:3 ()>]
4052: 4 [#<procedure 560f68620a00 at ice-9/boot-9.scm:4045:3 ()>]
1724: 3 [%start-stack load-stack ...]
1729: 2 [#<procedure 560f68638fc0 ()>]
In unknown file:
?: 1 [primitive-load "/home/mike/Projects/pip-tui/pip-tui/bug.scm"]
?: 0 [scm-error keyword-argument-error "eval" "Invalid keyword" () (2)]
ERROR: In procedure scm-error:
ERROR: Invalid keyword: 2
I can create some improvement by replacing the 'keyword-error-printer'
procedure in ice-9/boot-9.scm with the following
but I don't think that is the correct answer.
--- ice-9/boot-9.scm.0 2016-06-22 00:37:38.929112125 -0400
+++ ice-9/boot-9.scm 2016-06-22 01:02:11.032206795 -0400
@@ -1020,8 +1020,10 @@
(define (keyword-error-printer port key args default-printer)
(let ((message (cadr args))
- (faulty (car (cadddr args)))) ; I won't do it again, I promise.
- (format port "~a: ~s" message faulty)))
+ (faulty (cadddr args)))
+ (if (pair? faulty)
+ (format port "~a: ~s" message (car faulty))
+ (format port "~a" message))))
next parent reply other threads:[~2016-06-22 5:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <738648054.2214015.1466571839142.JavaMail.yahoo.ref@mail.yahoo.com>
2016-06-22 5:03 ` Mike Gran [this message]
2017-02-28 21:03 ` bug#23821: Misleading error for optargs Andy Wingo
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://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=738648054.2214015.1466571839142.JavaMail.yahoo@mail.yahoo.com \
--to=spk121@yahoo.com \
--cc=23821@debbugs.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.
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).