Re: Packages
- Posted by Jason Gade <jaygade at yah?o.?om> Aug 07, 2007
- 516 views
CChris wrote: > > Jason Gade wrote: > > > > CChris wrote: > > > > > > jacques deschĂȘnes wrote: > > > > > > > > Your system is too complex, it add a lot of new keywords. Why make it > > > > complex > > > > when one can make simple. > > > > > > Because simple systems won't work. > > > They will create issues of their own, out of short-sightedness. > > > > Surely you're joking? > > > > And in a different thread: > > > > > We seem to live on different planets. > > > > True. > > > > I agree. But some aspect of your planet are causing serious trouble to my > coding. > > > Here's my proposal, one new keyword, but I don't know if it is possible: > > import <lib> [as <namespace>] > > > > This works just like include but globals included or imported by imported > > files > > are no longer visible. It acts as a block to global namespace pollution. > > > > Basically it only imports symbols defined in <lib>, not symbols defined in > > <lib>'s > > includes or imported files. Those go... somewhere else. > > > > in my_app.exw: > import my_lib.e > > in my_lib.e > include get.e > > Can my_app.exw access routines in get.e? No, unless my_app.exw either includes or imports get.e itself. So it should be: in my_app.exw: import my_lib.e -- should only rely on the interface provided by my_lib.e include get.e -- or import -- shouldn't matter in a program file in my_lib.e include get.e -- I could export some of the get.e symbols if I needed to. > > If so: > > in my_lib.e: > global function my_func() > import my_utils.e > > in my_utils.e: > x=my_func() > > 1/ Is the above call valid? Should it be? I don't code that way. Obviously it's one of the situations that I'll have to think about. > 2/ What happens if my_app.exw also defines a global my_func(), and some other > file calls that global? This is starting to sound more and more like "goto". > Surely you're joking. Surely you are. And don't call me Shirley ;). -- "Any programming problem can be solved by adding a level of indirection." --anonymous "Any performance problem can be solved by removing a level of indirection." --M. Haertel "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.