Hi,

i'm debugging a Kawa/Java/Bigloo application and at some point  i have this 
error in a Kawa code (running in a Tomcat container):

Tomcat error log:

12-Jan-2017 09:58:45.850 SEVERE [http-nio-192.168.109.87-8080-exec-7] 
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for 
servlet [eu.oca.ApplicationConfig] in context with path [/Sidonie] threw 
exception [java.lang.ClassCastException: gnu.text.Char cannot be cast to 
java.lang.Number] with root cause
 java.lang.ClassCastException: gnu.text.Char cannot be cast to java.lang.Number
        at gnu.lists.Sequences.asIntSequenceOrNull(Sequences.java:49)
        at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:165)
        at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
        at 
eu.oca.kawafunct.ResultatGeneralAFKawa.work(ResultatGeneralAFKawa.scm:629)
        at eu.oca.ResultatGeneralAF.postHandler(ResultatGeneralAF.java:136)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


ResultatGeneralAFKawa.scm :

(display-msg-var-nl  "ResultatGeneralAFKawa : work : casetype = " casetype)

(if-t (and (string? casetype) (string=? casetype "ON"))
           (set! erreurgeneral 1)
           (if (or (string=? type1 "") (string=? type2 ""))
               (begin
                 (set! flagerreur 1)
                 (set! baraterreur (string-append baraterreur  " you forgot to 
give a min or a max spectral type ! ")))
               ;; else
               (begin
                 (set! nutype1
                       (case type1  ;; line 629
                         (("O") 1)
                         (("O0") 2)
                         (("O1") 3)
                         (("O2") 4)
                         (("O3") 5)
                         (("O4") 6)
                         (("O5") 7)
                         (("O6") 8)
                         (("O7") 9)
                         (("O8") 10)
                         (("O9") 11)
                         (("B") 12)
                         (("B0") 13)
                         (("B1") 14)
                         (("B2") 15)
                         (("B3") 16)
                         (("B4") 17)
                         (("B5") 18)
                         (("B6") 19)
                         (("B7") 20)
                         (("B8") 21)
                         (("B9") 22)
                         (("A") 23)
                         (("A0") 24)
                         (("A1") 25)
                         (("A2") 26)
                         (("A3") 27)
                         (("A4") 28)
                         (("A5") 29)
                         (("A6") 30)
                         (("A7") 31)
                         (("A8") 32)
                         (("A9") 33)
                         (("F") 34)
                         (("F0") 35)
                         (("F1") 36)
                         (("F2") 37)
                         (("F3") 38)
                         (("F4") 39)
                         (("F5") 40)
                         (("F6") 41)
                         (("F7") 42)
                         (("F8") 43)
                         (("F9") 44)
                         (("G") 45)
                         (("G0") 46)
                         (("G1") 47)
                         (("G2") 48)
                         (("G3") 49)
                         (("G4") 50)
                         (("G5") 51)
                         (("G6") 52)
                         (("G7") 53)
                         (("G8") 54)
                         (("G9") 55)
                         (("K") 56)
                         (("K0") 57)
                         (("K1") 58)
                         (("K2") 59)
                         (("K3") 60)
                         (("K4") 61)
                         (("K5") 62)
                         (("K6") 63)
                         (("K7") 64)
                         (("K8") 65)
                         (("K9") 66)
                         (("M") 67)
                         (("M0") 68)
                         (("M1") 69)
                         (("M2") 70)
                         (("M3") 71)
                         (("M4") 72)
                         (("M5") 73)
                         (("M6") 74)
                         (("M7") 75)
                         (("M8") 76)
                         (("M9") 77)
                         (else => (begin
                                    (display "WARNING : ResultatGeneralAFKawa : 
work : CASE type1 in else")
                                    (newline)
                                    '()))))
                

logs display this:

ResultatGeneralAFKawa : work : casetype = ON
WARNING : ResultatGeneralAFKawa : work : CASE type1 in else         

it seems Kawa Scheme both pass in the ELSE clause but error is before (line 629)

investigating a lot more i have also test the behavior of CASE in various 
Scheme and find it differ from one to another ,testing Kawa, Bigloo, MIT scheme 
it differs from Racket scheme
as see below:

[mattei@moita ~]$ kawa
#|kawa:1|# (case (string-append "do" "g") (("cat" "dog" "mouse") "animal") 
(else "mineral or vegetable"))
/dev/stdin:1:33: warning - datum type incompatible with the key
/dev/stdin:1:40: warning - datum type incompatible with the key
/dev/stdin:1:46: warning - there are 1 more datums that are incompatible with 
the key
mineral or vegetable
#|kawa:2|# (exit)
Vous avez du nouveau courrier dans /var/spool/mail/mattei
[mattei@moita ~]$ mit-scheme
MIT/GNU Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.

Copyright (C) 2014 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Image saved on Saturday May 17, 2014 at 2:39:25 AM
  Release 9.2 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118 
|| Edwin 3.116

1 ]=> (case (string-append "do" "g") (("cat" "dog" "mouse") "animal") (else 
"mineral or vegetable"))

;Value 13: "mineral or vegetable"

1 ]=> (exit)


Kill Scheme (y or n)? Yes
Moriturus te saluto.
[mattei@moita ~]$ bigloo
------------------------------------------------------------------------------
Bigloo (4.2c)                                                            ,--^,
`a practical Scheme compiler'                                      _ ___/ /|/
Tue Dec 8 08:07:49 CET 2015                                    ,;'( )__, ) '
Inria -- Sophia Antipolis                                     ;;  //   L__.
email: [email protected]                              '   \    /  '
url: http://www-sop.inria.fr/indes/fp/Bigloo                       ^   ^
------------------------------------------------------------------------------


1:=> (case (string-append "do" "g") (("cat" "dog" "mouse") "animal") (else 
"mineral or vegetable"))
mineral or vegetable
1:=> (exit)
[mattei@moita ~]$ racket
Welcome to Racket v6.3.
> (case (string-append "do" "g") (("cat" "dog" "mouse") "animal") (else 
> "mineral or vegetable"))
"animal"
> (exit)

the predicate to test equality in CASE is eqv? , not equal? (should be better 
IMHO) 

when strings equal (eqv?) i have same behavior in kawa than racket but not for 
bigloo or mit-scheme:
  
mattei@moita ~]$ kawa
#|kawa:1|# (case "dog" (("cat" "dog" "mouse") "animal") (else "mineral or 
vegetable"))
animal
#|kawa:2|# (exit)


[mattei@moita ~]$ bigloo
------------------------------------------------------------------------------
Bigloo (4.2c)                                                            ,--^,
`a practical Scheme compiler'                                      _ ___/ /|/
Tue Dec 8 08:07:49 CET 2015                                    ,;'( )__, ) '
Inria -- Sophia Antipolis                                     ;;  //   L__.
email: [email protected]                              '   \    /  '
url: http://www-sop.inria.fr/indes/fp/Bigloo                       ^   ^
------------------------------------------------------------------------------


1:=> (case "dog" (("cat" "dog" "mouse") "animal") (else "mineral or vegetable"))
mineral or vegetable
1:=> (exit)
[mattei@moita ~]$ mit-scheme
MIT/GNU Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.

Copyright (C) 2014 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Image saved on Saturday May 17, 2014 at 2:39:25 AM
  Release 9.2 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118 
|| Edwin 3.116

1 ]=> (case "dog" (("cat" "dog" "mouse") "animal") (else "mineral or 
vegetable"))

;Value 13: "mineral or vegetable"

1 ]=> (exit)


Kill Scheme (y or n)? Yes
Moriturus te saluto.

perheaps because they use eq? predicate to test strings:

[mattei@moita ~]$ kawa
#|kawa:1|# (eq? "dog" "dog")
#t

for this one racket and kawa behave equally 

mattei@moita ~]$ bigloo
------------------------------------------------------------------------------
Bigloo (4.2c)                                                            ,--^,
`a practical Scheme compiler'                                      _ ___/ /|/
Tue Dec 8 08:07:49 CET 2015                                    ,;'( )__, ) '
Inria -- Sophia Antipolis                                     ;;  //   L__.
email: [email protected]                              '   \    /  '
url: http://www-sop.inria.fr/indes/fp/Bigloo                       ^   ^
------------------------------------------------------------------------------


1:=> (eq? "dog" "dog")
#f
[mattei@moita ~]$ mit-scheme
MIT/GNU Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.

Copyright (C) 2014 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Image saved on Saturday May 17, 2014 at 2:39:25 AM
  Release 9.2 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118 
|| Edwin 3.116

1 ]=> (eq? "dog" "dog")

;Value: #f

regards,

Damien


-- 
[email protected], [email protected], UNS / OCA / CNRS

Reply via email to