On Wed, Nov 14 2012, Per Bothner wrote: > On 11/14/2012 01:01 PM, Marc Feeley wrote: >> Let me say that I find it contrary to the spririt of Scheme to >> prevent redefinition and assignment of exported variables. > > Let me say that regardless of the "spirit of Scheme", I think disallowing > redefinition / re-assignment is a Good Thing. At least as a default: > It might be reasonable to allow re-assignment for variable that have been > explicitly declared to allow that, though I don't see a major use case > for it.
Erlang, a language that has otherwise no assignments, supports "code replacement": http://www.erlang.org/doc/reference_manual/code_loading.html#id83993 That's a valuable feature not just for debugging but also for maintaining long running servers. > Also, an implementation might allow a "debug mode" that can allow > exported variables to be re-assigned, but I don't think it should be > alloweded in normal use. > > Two alternative to consider (perhaps for WC2): > > * Kawa has a define-variable form which is used to explicitly mark dynamic > variables. I.e. these force dynamic run-time lookup, without inlining. > This is also a convenient way to turn off compile-time undefined-variable > warnings/errors, for compilers that offer that. > > * A mechanism to define "properties": Associate a variable with a pair > of a getter and a setter function. This allows generate read or write hooks > (useful for debugging and many other purposes). One might allow exporting > of a getter/setter pair, which can be used as a variable. > (This is just an idea - I haven't actually tried to see how this might > work for Scheme libraries.) Easier to use might be a library declaration like (mutable #t) that tells the system that all bindings in this library should be mutable (and not inlinable) with set!. Helmut _______________________________________________ Scheme-reports mailing list [email protected] http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports
