[r6rs-discuss] [Formal] Disallow redefinitions macros/variables
andre at het.brown.edu
Mon Mar 26 15:03:27 EDT 2007
This message is a formal comment which was submitted to formal-comment at r6rs.org, following the requirements described at: http://www.r6rs.org/process.html
Name : Andre van Tonder
Email : andre at het.brown.edu
Type : improvment
Priority : medium
Component : sections 9.1, 9.2 (definitions and syntax definitions)
Version : 5.92
Pages : 27
Dependencies: sections 8 (expansion) and 10 (semantics)
Disallow redefinitions of macros and variables in case of
multiple return to RHS continuations.
A prior thread
discusses a problem that may be caused by multiple returns to
library toplevel variable definitions.
I would like to point out that strange behaviour might also be
obtained in case of multiple returns to /macro/ definitions, also
/internal/ macro definitions.
I would therefore suggest outlawing multiple returns to macro
defintions, library-toplevel and internal.
I further suspect that allowing multiple returns to internal variable
definitions are also bad, because
- I suspect that it may make certain optimizations
(such as detecting possibilities for inlining or direct
substitution) more difficult. It is no longer sufficient
to detect set! statements to determine mutability.
Mutability detection becomes undecidable.
- The intention of mutation does not get clearly expressed.
I think it would be better if programmers were required to
express all mutations using set!. In other words, I think
programmers should be required to write
(set! x (call/cc (lambda (k) k))))
(unless (number? x)
(define x (call-cc -----))
Require a solution such as the one suggested in
also for internal definitions.
Further outlaw multiple returns to macro definitions.
This could perhaps also be succinctly expressed in the semantics by
extending the current formal semantics, with the appropriate changes,
to DEFINE in internal positions also.
More information about the r6rs-discuss