Re: Packages
- Posted by Jason Gade <jaygade at yahoo.?om> Aug 07, 2007
- 532 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? > > 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? On further consideration this should break. Include should treat files as text, import should treat files as modules and work one way. > 2/ What happens if my_app.exw also defines a global my_func(), and some other > file calls that global? It depends if the other files are linked with include or import. -- "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.