Subject: Re: bug#23821: Misleading error for optargs

From: Andy Wingo <[email-masked]>
Date: Tue, 28 Feb 2017 22:03:10 +0100

On Wed 22 Jun 2016 07:03, Mike Gran <[email-masked]> writes:

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

I have now fixed this in 2.0 and master.  In master it led me to
discover a pretty serious bug.  Now what you get at run-time is:

  wingo@clucks:~/src/guile$ meta/guile /tmp/foo.scm
  ;;; note: source file /tmp/foo.scm
  ;;;       newer than compiled /home/wingo/src/guile/cache/guile/ccache/2.2-LE-8-3.9/tmp/foo.scm.go
  ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
  ;;;       or pass the --no-auto-compile argument to disable.
  ;;; compiling /tmp/foo.scm
  ;;; /tmp/foo.scm:4:4: warning: wrong number of arguments to `func'
  ;;; compiled /home/wingo/src/guile/cache/guile/ccache/2.2-LE-8-3.9/tmp/foo.scm.go
  Backtrace:
             6 (apply-smob/1 #<catch-closure 8730a0>)
  In ice-9/boot-9.scm:
      713:2  5 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
  In ice-9/eval.scm:
      619:8  4 (_ #(#(#<directory (guile-user) 8eb6c0>)))
  In ice-9/boot-9.scm:
     2346:4  3 (save-module-excursion _)
    3843:12  2 (_)
  In /tmp/foo.scm:
        4:4  1 (_)
        2:0  0 (func _ #:B _)

  /tmp/foo.scm:2:0: In procedure func:
  /tmp/foo.scm:2:0: Invalid keyword: 2

Which seems OK.

Andy