Hi Joseph,
You are just right. The typing rules are currently wrong. This can be
checked on the following:
$ cat > foo.scm
(module foo
(export (class point (x (default 10)))
(foo x::point z)))
(define (foo x::point z)
(define (bar n)
(cons x (bar (-fx n 1))))
(set! x (instantiate::point))
(bar 10))
$ bigloo foo.scm -unsafe -integrate -shapet
(define (foo::obj x::point z::obj)
(let ((x::point (make-box x::point)))
(begin
(let ((aux::obj
(let ((new1050::point
(unsafe
(let ((new1049::point
(free-pragma
"((BgL_pointz00_bglt)BREF( GC_MALLOC(
sizeof(struct BgL_pointz00_bgl) )))")))
(begin
(let ((arg1062::long
(let ((res1115::long
(let ((class::class point::class))
(|$class-index::long[::_]|
("type:" "long")
class::class))))
res1115::long)))
(let ((obj::object new1049::point)
(num::long arg1062::long))
(|%object-class-num-set!::obj[::_]|
("type:" "obj")
obj::object
num::long)))
new1049::point)))))
(begin
(setfield
("BgL_xz00" obj)
point
new1050::point
#(10 "long" "long"))
#(#f "bool" "bool")
new1050::point))))
(box-set! |x::point[::obj]| aux::obj))
(bar~0::pair
("type:" "pair")
x::point
#(10 "long" "long")))))
The first let binding is wrong. It should be:
(let ((x::cell (make-cell x::point)))
...)
and later on transformed into:
(let ((x::cell (make-cell (cast obj x::point))))
...)
This bug has been here forever. I don't understand how it can had stayed
unnoticed so long. I will work on that problem as soon as possible.
--
Manuel