This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Kawa proposed typing changes
On 09/26/2009 11:21 AM, Helmut Eller wrote:
* Per Bothner [2009-09-26 18:34+0200] writes:
A minor question is if
(+ int (+ integer-literal integer-literal))
has a different type than
(+ (+ int integer-literal) integer-literal)
Good question. They both get int type:
(define (Foo (x :: int))
(let ((y (+ x (+ 2 3)))
(z (+ (+ x 5) 7)))
(* y z)))
becomes:
Method name:"Foo" public static Signature: (int)int
Attribute "Code", length:81, max_stack:3, max_locals:3, code_length:15
0: iload_0
1: iconst_5
2: iadd
3: iload_0
4: iconst_5
5: iadd
6: bipush 7
8: iadd
9: istore_2
10: istore_1
11: iload_1
12: iload_2
13: imul
14: ireturn
or string conversions are needed.
What "string conversions" were you thinking about?
Code like this:
(define (foo (s java.lang.String)) s)
(define (bar (s String)) (foo s))
(define (baz (s gnu.lists.FString)) (bar s))
(let ((x (string #\a)))
(list (instance? x java.lang.String)
(instance? (baz x) java.lang.String)))
=> (#f #t)
Apparently x gets converted to java.lang.String somewhere along the way.
Warnings about
improper tail calls would also be nice.
I'm concerned about too many false positives.
Any ides for avoiding that?
If there is a compiler switch like [no-]warn-tail-calls it could be used
as argument to with-compile-options on selected regions. Or the
compiler switch could also have arguments to name [un]interesting
functions like
(with-compile-options warn-tail-calls: (foo) no-warn-tail-calls: (bar)
(if x
(foo) ; warn
(bar) ; ignore
))
BTW, it would be useful if Kawa had a disassemble function which takes
procedures as argument. That would be much more convenient than
compiling to a class file and calling javap on it.
I agree. More soon ...
--
--Per Bothner
per@bothner.com http://per.bothner.com/