Re: Do you currently use namespaces?
- Posted by Derek Parnell <ddparnell at bi?pon?.com> May 26, 2008
- 1222 views
ken mortenson wrote: By the way, ken, and please don't take this the wrong way because I'm guilty of this, but your posts are starting to look a little condescending. I'm putting this effect down to the limitations of this particular communication medium, however it might be an idea to de-emphasize the language that seems to suggest that you know the "right thing" and no one else gets it. > Jeremy Cowgar wrote: > > ken mortenson wrote: > > > Order does matter using include. > > > > In what way? With Euphoria, order does matter. This has nothing intrinsicly to do with include files though. For better or worse, Euphoria has the deliberate restriction that one can only directly refer to symbols that are lexically declared (and exposed) earlier than their reference. So yes, order does matter. > Given my example of the user and note module. One is not depending > > on another, order could care less. I've never had to order any of my > > includes. > > I am unsure of any situation you would have to, can you give me an example? I can Jeremy. When writing the win32lib, I often had to reorder symbol declarations when a new bit of code needed to refer to something further on down (either in an included file or in the same file). This became so frustrating that I started (ab)using the routine_id() method just so I didn't have to reorganize the source code yet again. This has nothing to do with modular programming though. It is just a feature of Euphoria's design philosophy. > If you accept that, can you accept that ordering is a kind of coupling > that means it is less than modular? Smarter people than me have written > books on the subject. Yes, dependancies on the physical layout of code is a sort of coupling. However Euphoria, being a procedural language rather than a functional language, we will always be beholden to some aspects of the way code is organised. For example, we expect that the next statment to be executed will be the one after the current one (in most cases). > BTW, even Delphi has this problem so you are not the only one to be > confused by the concept. I am not confused by the concept of modules or modularity. There are many types of module systems, each with strengthes and weaknesses. Euphoria has a system of modules. The module is embodied in a single file. The module exposes its API via the 'global' keyword. It exposes this API to every line of code that follows the 'include' directive for the file, and conversely hides its API to code preceding the 'include' directive. That's about it for Euphoria. Can it be better? Sure it can! But define "better" first. You seem to be saying at least two things can be improved. Firstly that the forward referencing restriction be removed or amended. Secondly, that a module's API can have a mechanism that only exposes it (or selected parts of it) to the file that directly includes the module. Have I got that right? -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell