#9 bigloo DEFINE: wrong expansion

open
nobody
bigloo (13)
5
2000-07-27
2000-07-27
No

Wrong statement construction in interpreter

(pp
(expand-once
'(define(aaa)
(define qqq some)
(set! qqq 2)
(define new (+ qqq qqq))
new)))

------------------------------------------------------------------------------
1:=> (DEFINE AAA
(LAMBDA ()
(BEGIN
((LAMBDA (NEW QQQ)
(BEGIN
(SET! QQQ SOME)
(SET! NEW (+ QQQ QQQ))
(SET! QQQ 2)
NEW))
0
0))))

------------------------------------------------------------------------------
as you may see, the NEW variable initialization uses the old value of QQQ (SOME instead of 2)

The compiler should either:

1) generate error message, since the construction is not allowed by R5RS

2) silently convers all `defines' into LET statements

Discussion