RE: Namespace improvement ?
- Posted by Georg Wrede <georg at iki.fi> Feb 09, 2005
- 473 views
Ehhh, we are not getting anywhere with this discussion. Lemme phrase the problem in another way: Andy has written a low level file he wants "The B kind of people" to include in their projects. He documents it meticulously. Ben stumbles upon this file, and decides to write a high level file to do more elaborate things. He reads Andy's docs and starts to write. Obviously, Ben assumes that Andys variables and functions will not pollute Ben's "clients'" namespace. Ben documents diligently what functions and constants he wants his "clients" to use. Those he also explicitly makes visible to the "includer" of his file. Carl finds Ben's file, and its documentation. He decides to use it in his following application. Naturally, he assumes, the only things that he has to be carerul with, are the names that Ben has documented. The next-to last thing he could possibly fear is, that a lot of Ben's undocumented crap pollutes his namespace. But, the very ultimate thing (he couldn't even begin to fear) is, that all kinds of crap from _Andys_ file would crap his namespace. Heck, Ben's never even told anybody that he'd never've been able to write his own file without Andy's excellent low level routines, constants and stuff. So, Carl never saw the train that came and squashed him right in the intersection. ((You better read the above twice before reading the rest.)) -------------------------- Put it another way: (Disclaimer: in the following I've used author names from this forum. The names have been chosen totally arbitrarily, to create a sense of reality here. Please, anybody, don't get offended.) I write a library for machine-to-machine communication. This library is all about MAC addresses and Bootp and stuff. Chris Bensler sees this, and writes a library for reliable file transfer on top of this, that can also be used to transport messages. Pete Lomax sees Chris' library and writes a distributed file system on top of that. Patrick Barnes sees Pete's file system, and decides to write a computer farm operating system on top of it. Now, the late, Carl Sagan sees Patrick's library, and decides to write a "truly" global app on top of it, to finally find the Extra Terrestials. (No disrespect intended here!) ------ My question is: who in the previous train of programmers wants his namespace occupied by gratuitious entities???????????? Aren't they all happy with what's documented and relevant to the immediate Purpose of the (single) library each of them are using? If Carl Sagan wanted to use some (or all) of the routines in my original Machine-To-Machine library, wouldn't he import it explicitly???? And the same with Pete's stuff, right? So Carl Sagan would be happy with Pete's stuff, -- BUT ONLY if he wanted it himself. And definitely not by Pete's stuff secretly sneaking in Carl's namespace, just because he happened to "use" Patrick's code. ----------- If I write code in Euphoria, I _WANT_ to _not_ know about the thousands of constants and functions that exist within Windows. If I explicitly "import", "include" (or whatever the word would be called tomorrow) some library, I definitely want to only have to deal with what the library author advertises as useful. I want to receive HTTP messages without knowing about MAC addresses. Or without having to search through trees of include files -- just to see if my mysterious bug was because I happened to step on a name defined in the ancestor of my import's great grandfather. Or even my import's father. -- Another Euphoric, since Nov. 18, 2004 --