[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-kawa] [bug #39059] Method keywords problem
From: |
Matthieu Vachon |
Subject: |
[Bug-kawa] [bug #39059] Method keywords problem |
Date: |
Fri, 24 May 2013 02:23:17 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?39059>
Summary: Method keywords problem
Project: Kawa
Submitted by: maoueh
Submitted on: Fri 24 May 2013 02:23:16 AM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I define a method taking keyword arguments, when I retrieve one without
retrieving another one, the completely wrong value is returned. It looks like
there is a big problem with bindings.
Take the following example:
(define (small #!key (a "default a") (b "default b") (c "default c"))
(newline)
(format (current-output-port) "Test small~%")
(format (current-output-port) " A => ~a~%" a)
;;(format (current-output-port) " B => ~a~%" b)
(format (current-output-port) " C => ~a~%" c))
(small a: "a" b: "b" c: "c")
It prints
Test small
A => a
C => b
The second line should have been "C => c". This happens in 1.12 and latest
version.
Uncommenting the commented line make it works correctly though.
Also, maybe related, maybe not, using and invalid keyword works also, maybe
because bindings is not done at the right index. For example, this call
`(small a: "a" b: "b" invalid-c: "c")` also gives:
Test small
A => a
C => b
For a big test case, order is even stranger:
(define (big #!key
(a "default a") (b "default b")
(c "default c") (d "default d")
(e "default e") (f "default f")
(g "default g") (h "default h")
(i "default i") (j "default j")
(k "default k") (l "default l")
(m "default m") (n "default n")
(o "default o"))
(newline)
(format (current-output-port) "Test Big~%")
(format (current-output-port) " C => ~a~%" c)
(format (current-output-port) " D => ~a~%" d)
(format (current-output-port) " E => ~a~%" e)
(format (current-output-port) " F => ~a~%" f)
(format (current-output-port) " K => ~a~%" k)
(format (current-output-port) " L => ~a~%" l)
(format (current-output-port) " M => ~a~%" m))
(big a: "a" b: "b" e: "e" f: "f" o: "o" n: "n" i: "i" g: "g" h: "h")
Will print the following (all wrong) output:
Test Big
C => a
D => b
E => default e
F => default f
K => e
L => f
M => g
I attached my test script.
Regards,
Matt
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Fri 24 May 2013 02:23:16 AM GMT Name: keywords-problem.scm Size: 1kB
By: maoueh
<http://savannah.gnu.org/bugs/download.php?file_id=28154>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39059>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Bug-kawa] [bug #39059] Method keywords problem,
Matthieu Vachon <=