This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Error of using <integer>?
Yaroslav Kavenchuk wrote:
(define (!i x :: <integer>) :: <integer>
(letrec ((!!i (lambda (i :: <integer> k :: <integer>) :: <integer>
(if (= i 1)
k
(!!i
(- i 1)
(* i k))))))
(!!i x 1)))
#|kawa:36|# (define x (!i 2352))
#|kawa:37|# (define x (!i 2353))
java.lang.StackOverflowError
It works for me. But I'm running on GNU/Linux (Fedora 8),
which may mean I have a different default stack size.
I looked at the generated bytecode for the two versions:
The untyped version is tail-recursive (i.e. is compiled
to a loop), while the typed one isn't (i.e. is compiled
to a recursive call).
I'll take a look to see if I can figure out why.
--
--Per Bothner
per@bothner.com http://per.bothner.com/