--- Abdulaziz Ghuloum <aghuloum_at_cs.indiana.edu> wrote:
> I'm thinking that the "once-only" restriction should apply to top-level
> definitions and expressions as well. Am I correct?
Apply a "once-only" restriction to top-level _expressions_? Why?
Unless I'm mistaken, this is a valid R6RS program:
#!r6rs
;imports
(import (r6rs base))
;a definition
(define foo #f)
;some expressions
(set! foo (call/cc (lambda (k) (cons k 1))))
(newline)
(let ((k (car foo)) (n (cdr foo)))
(display n)
(if (>= n 5) (newline)
(k (cons k (+ n 1)))))
If I wrap everything after the import in a (begin ...), I have valid R5RS code that displays
12345. I don't see why re-entering the set! should be disallowed in R6RS.
Suppose the program is modified so that the define is re-entered:
#!r6rs
;imports
(import (r6rs base))
;a definition
(define foo (call/cc (lambda (k) (cons k 1))))
;some expressions
(newline)
(let ((k (car foo)) (n (cdr foo)))
(display n)
(if (>= n 5) (newline)
(k (cons k (+ n 1)))))
Among other possibilities, an implementation might behave exactly like it was given the first
program, it might display 1 only once, it might display an infinite series of 1's, or it might
raise an error. I think this situation might fall within the scope of the the original comment, or
perhaps the original comment should be expanded to handle it as well.
Regardless of how it's addressed in R6RS, I think R6RS should give implementations room to ignore
the situation and behave in an unspecified manner.
Nate T.
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
Received on Mon Mar 12 2007 - 16:22:50 UTC