• 9 Posts
  • 14 Comments
Joined 1 year ago
cake
Cake day: October 2nd, 2023

help-circle
  • Program :

    
    (module-name MyTest)
    (module-compile-options main: #t)
    
    (define (main)
        (define ar ::java.util.ArrayList[symbol] (java.util.ArrayList))
        (ar:add 'a)
        (ar:size)
        (ar:add 1))
    (main)
    
    

    Error:

    
    (compiling ./MyTest.scm to MyTest)
    ./MyTest.scm:9:13: warning - type integer is incompatible with required type symbol
    ./MyTest.scm:9:5: warning - cannot convert literal (of type gnu.math.IntNum) to ClassType gnu.mapping.Symbol
            0,32 real         0,53 user         0,07 sys
    java.lang.ClassCastException: class gnu.math.IntNum cannot be cast to class gnu.mapping.Symbol (gnu.math.IntNum and gnu.mapping.Symbol are in unnamed module of loader 'app')
    	at MyTest.main(MyTest.scm:9)
    	at MyTest.run(MyTest.scm:5)
    
    

    µ













  • Program below works fine with sbcl & ccl.
    For abcl i get alot of warnings, not errors,

    
    (load "~/quicklisp/setup.lisp")
    (declaim (optimize (speed 3) (safety 3)))
    
    (ql:quickload "serapeum")
    
    (defpackage alain
      (:use :cl :serapeum)
      (:export main));defpackage
    
    (in-package :alain)
    
    (declaim (type (integer) *anint*))
    (defparameter *anint* 2)
    
    (-> addtwo ( integer ) integer )
    (defun addtwo (x)
      ( + *anint* x ))
    
    (defun main ()
    	(print (addtwo 3)));main
    
    (in-package :cl)
    (defun main ()
      (alain::main))
    (main)
    
    

    ; Compilation unit finished ; Caught 22 WARNING conditions ; Caught 10 STYLE-WARNING conditions