[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 1999-11-18 (19:27) |
From: | Gerard Huet <Gerard.Huet@i...> |
Subject: | RE: Undefined labels |
At 16:30 15/11/99 -0800, Brian Rogoff wrote: >On Fri, 12 Nov 1999, Manuel Fahndrich wrote: >> >> This is the standard example for why we need a local open in the language. >> >> -Manuel > >Let me second that motion. Coming from Ada, I always wondered why OCaml >doesn't allow you to restrict the scope of open, instead of putting it >always at module level. > >-- Brian > open is a facility that is convenient to the programmer because the code is uncluttered with long explicit names, but it is of course a source of bugs. The addition of a new binding in a module may change drastically the semantics of modules which open it, in a way that stays unnoticed if types match. Things would get worse with a local open. This reminds me of the old days of Pascal, with the dreadful "with" construction which opened an implicit scope (the field names of the corresponding record declaration) at this point in the code. This made the scope structure dependent of the type analysis in a global way, and thus broke an essential phase distinction for the compiler. This was the source of unending headaches. For instance, it was a cause of unnecessary complications in terminal recursion removal, since the names of the formal parameters of procedures could be hidden at the point of call by an intermediate with. GH