unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Daniel Llorens <dll@jast.ch>
Cc: 12929@debbugs.gnu.org
Subject: bug#12929: case-lambda*
Date: Wed, 28 Nov 2012 23:36:15 +0100	[thread overview]
Message-ID: <87boehbbj4.fsf@gnu.org> (raw)
In-Reply-To: <30EECB7A-D12A-4BE4-B2D0-7AD24B5A1DD9@jast.ch> (Daniel Llorens's message of "Mon, 19 Nov 2012 11:38:17 +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	other threads:[~2012-11-28 22:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 10:38 bug#12929: case-lambda* Daniel Llorens
2012-11-28 22:36 ` Ludovic Courtès [this message]
2013-03-05 17:54 ` 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=87boehbbj4.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=12929@debbugs.gnu.org \
    --cc=dll@jast.ch \
    /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).