GNU bug report logs - #12929
case-lambda*

Previous Next

Package: guile;

Reported by: Daniel Llorens <dll <at> jast.ch>

Date: Mon, 19 Nov 2012 11:02:01 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12929 in the body.
You can then email your comments to 12929 AT debbugs.gnu.org in the normal way.

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#12929; Package guile. (Mon, 19 Nov 2012 11:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Llorens <dll <at> jast.ch>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 19 Nov 2012 11:02:02 GMT) Full text and rfc822 format available.

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

From: Daniel Llorens <dll <at> jast.ch>
To: bug-guile <at> gnu.org
Subject: case-lambda*
Date: Mon, 19 Nov 2012 11:38:17 +0100
See the thread here 

http://lists.gnu.org/archive/html/guile-user/2012-11/msg00032.html

In Guile 2.0.6

(define f (case-lambda*
             ((x #:optional y) 1)
	     ((x #:key y)      2)
	     ((x y #:key z)    3)))

(f 1 2 #:z 3) -> Odd length of keyword argument list

Also

(define g (case-lambda*
                      ((a #:key x) 1)
                      ((a b c #:key x) 3)))

(g 1 2 3) - > Invalid keyword

This behavior doesn't seem useful and doesn't follow from the doc on case-lambda*, which is rather vague and lacks examples.

The case-lambda* test in tree-il.test also fails on the REPL

(let ((f (case-lambda*
          ((x #:optional y) 1)
          ((x #:key y)      2)
          ((x y #:key z)    3))))
  (list (f 1)
        (f 1 2)
        (f #:y 2)
        (f 1 2 #:z 3)))

-> Odd length of keyword argument list

Thanks,

	Daniel





Information forwarded to bug-guile <at> gnu.org:
bug#12929; Package guile. (Wed, 28 Nov 2012 22:39:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Daniel Llorens <dll <at> jast.ch>
Cc: 12929 <at> debbugs.gnu.org
Subject: Re: bug#12929: case-lambda*
Date: Wed, 28 Nov 2012 23:36:15 +0100
Hi,

Indeed, there’s something wrong.  The “Odd length” error comes from the
‘bind-kwargs’ corresponding to the first case of the ‘case-lambda*’:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (case-lambda*
	     ((x #:key y)      2)
	     ((x y #:key z)    3))
$63 = #<procedure 22a0d40 at <current input>:4761:0 (x #:key y) | (x y #:key z)>
scheme@(guile-user)> ($63 1 2  #:z 3)
<unnamed port>:4761:0: In procedure #<procedure 22a0d40 at <current input>:4761:0 (x #:key y) | (x y #:key z)>:
<unnamed port>:4761:0: In procedure #<procedure 22a0d40 at <current input>:4761:0 (x #:key y) | (x y #:key z)>: Odd length of keyword argument list

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,proc
$64 = #<procedure 22a0d40 at <current input>:4761:0 (x #:key y) | (x y #:key z)>
scheme@(guile-user) [1]> ,x $64
Disassembly of #<procedure 22a0d40 at <current input>:4761:0 (x #:key y) | (x y #:key z)>:

   0    (br-if-nargs-lt 0 1 :L49541)    ;; -> 34
   6    (bind-optionals/shuffle 0 1 0 1 0 2)
  13    (bind-kwargs 0 1 0 2 0)         
  19    (reserve-locals 0 2)            
  22    (local-bound? 1)                
  24    (br-if :L49542)                 ;; -> 31
  28    (make-false)                    
  29    (local-set 1)                   ;; `y'
  31    (make-int8 2)                   ;; 2
  33    (return)                        
  34    (assert-nargs-ge 0 2)           
  37    (bind-optionals/shuffle 0 2 0 2 0 3)
  44    (bind-kwargs 0 2 0 3 0)         
  50    (reserve-locals 0 3)            
  53    (local-bound? 2)                
  55    (br-if :L49543)                 ;; -> 62
  59    (make-false)                    
  60    (local-set 2)                   ;; `z'
  62    (make-int8 3)                   ;; 3
  64    (return)                        

scheme@(guile-user) [1]> ,regs
  Registers:
  $65 = ip = 19
  $66 = sp = #x2dacd58
  $67 = fp = #x2dacd38
--8<---------------cut here---------------end--------------->8---

Seems to me that for this to work, we’d need a variant of ‘bind-kwargs’,
say ‘br-if-kwargs-match’, that allows a jump to the next case upon
mismatch.

At least, I can’t think of any other way to generate a prelude that
would work (search for <glil-kw-prelude> in compile-assembly.scm.)

Thoughts?

Thanks,
Ludo’.




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Tue, 05 Mar 2013 18:55:09 GMT) Full text and rfc822 format available.

Notification sent to Daniel Llorens <dll <at> jast.ch>:
bug acknowledged by developer. (Tue, 05 Mar 2013 18:55:10 GMT) Full text and rfc822 format available.

Message #13 received at 12929-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Daniel Llorens <dll <at> jast.ch>
Cc: 12929-done <at> debbugs.gnu.org
Subject: Re: bug#12929: case-lambda*
Date: Tue, 05 Mar 2013 18:54:13 +0100
On Mon 19 Nov 2012 11:38, Daniel Llorens <dll <at> jast.ch> writes:

> http://lists.gnu.org/archive/html/guile-user/2012-11/msg00032.html

Fixed, with notes in that thread.  Thanks again for the report!

Andy
-- 
http://wingolog.org/




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 03 Apr 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 19 days ago.

Previous Next


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