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’.