[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Scheme-reports] set! and imported identifiers
- To: scheme-reports <scheme-reports@x>
- Subject: [Scheme-reports] set! and imported identifiers
- From: Marc Feeley <feeley@x>
- Date: Sat, 13 Oct 2012 16:56:53 -0400
To my dismay I have stumbled across this passage, which I seem to have skipped, or misunderstood, in my previous readings :
"In a library declaration, it is an error to import the same identifier more than once with different bindings, or to redefine or mutate an imported binding with define, define-syntax or set!. However, a REPL should permit these actions."
I have a problem with the restriction on set!. What is the rationale for preventing set! on imported identifiers? This restricts the language and adds complexity (not all variables can be written to). It prevents the definition and use of a "trace" macro, live code patching, etc. These are features I expect of a dynamic language and Scheme.
Moreover, it is not clear what is meant by "a REPL should permit these actions". Does "eval" count as "a REPL"? Does it mean that it is only OK if the "set!" was entered at *the* REPL that comes with the system? Or it is always OK on Scheme systems with a REPL? Is it OK if I load from the REPL a file which has a function which does the "set!"? (this would be consistent with the abstraction principle)
If there is a restriction on set!, then I can't implement a REPL with eval using portable code. I can't write a portable "trace" macro. I can't write a portable debugger.
I would like to remove this restriction on set! that makes a builtin REPL appear necessary.
Scheme-reports mailing list