|
From: Matthias B. <bl...@re...> - 2001-09-17 14:09:51
|
Dave Berry wrote: > > At 15:00 14/09/2001, Robert Harper wrote: > >2. How much should the language be tied to the existence of an interactive > >system? > > The current notion of the top-level is a complete anachronism, and > positively hinders the development of a decent programming environment. It > inherits from Lisp the concept of redefining a function in isolation from > the rest of the current scope, but this is unsuitable for a strongly-typed, > statically-scoped language like ML. I believe that every definition in a > program should have a unique path that can be used to identifiy it, without > having to add any extrinsic information such as the line number within a > file. This would have the corollary that no identifier could be redefined > in the same scope. (Inner or outer scopes could contain other definitions > of the identifier, but they would have different paths). I disagree with this view. If you prohibit redefinitions of names, you get a serious modularity problem: Any program that has a global or local name "foo" can no longer be linked with a library that exports a binding under the name "foo". The ability to redefine (in some way or the other, including perhaps a way of "ending" or "containing" the scope of a formely global definition -- which can be seen as a form of redefinition) is absolutely essential for avoiding this problem. See my thesis and our (Andrew Appel's and my) TOPLAS paper on this. As for the interactive toplevel: I agree with you that having it is pretty useless for anyone outside the theorem-proving community. The "default" implementation should be a batch compiler, an interactive toplevel can easily be provided by an application library. I am currently pushing SML/NJ in this direction (and quite successfully, I think). On the other hand, I do not agree with your assessment that there is something fundamentally flawed about the way the interactive toplevel works in ML. This is precisely because it does _not_ work like the Lisp or Scheme toplevel where a function or variable can be redefined "after the fact". In ML, every definition starts a new scope, so everything stays perfectly consistent. (Of course, to those who are emotionally attached to the Lisp way, this is also one of the main weaknesses of the ML toplevel because it does not allow for "interactive patching" of broken code.) Anyway, I can live with the idea of not having an interactive toplevel. (I haven't been using it for a while anyway -- except for issuing commands such as CM.make...) On the other hand, not being able to redefine (locally or at the (non-interactive) toplevel) a globally bound name is absolutely unacceptable IMO. Matthias |