Re: private include files
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 14, 2004
- 416 views
Pete Lomax wrote: [snip] > For example, under the proposals as I understand them, what is the fix > required for this? > > }}} <eucode> > include win32lib.ew > pretty_print(1,sort(lower("cBa")),{}) > </eucode> {{{ > > Not difficult, but it must be properly documented, and justified. I assume you are referring to the idea that 'include' be private by default and thus the example above would fail because it assumes that the symbols 'pretty_print', 'sort', and 'lower' are visible because win32lib.ew includes files that define those as global symbols. One could argue that it is each program file's responsibility to import the symbols it is using. Thus the 'fix' to the above code would be ...
include win32lib.ew include sort.e include wildcard.e include misc.e pretty_print(1,sort(lower("cBa")),{})
This is a philosophy issue really, in that we need to explore the ideas behind how should one write program code? In keeping with the private-by-default concept, we could also suggest that the above problem could be fixed by writting ...
global include win32lib.ew pretty_print(1,sort(lower("cBa")),{})
In which case the 'global' qualifier would mean that any global symbols that win32lib.ew can see are also made global in the current context. However, my original suggestion was made thinking that backward compatibility was to be maintained at all costs. (Not something that I'm dogmatic about, BTW). If I was to approach this issue without regard to existing code, I would suggest a very much more radical change. But as that'll not be implemented by RDS in our lifetimes, I'll not bother discussing that here and now. -- Derek Parnell Melbourne, Australia