Re: Do you currently use namespaces?
- Posted by Jeremy Cowgar <jeremy at c?w?ar.com> May 26, 2008
- 1084 views
ken mortenson wrote: > > Jeremy Cowgar wrote: > >how does include make it not modular? > >I do not see how what you said is making Euphoria not modular? > >Can you expand a bit? > > Absolutely, > > Keep in mind that a programmer can write code in a modular language that > isn't modular and another could write good modules in a language that isn't > supportive of that. > > Good modules should have certain features. > > Decoupling is an important principle as well as the principle of > information hiding. They don't expose their internal structure but > do expose an interface. > > What happens when you include a file? Everything becomes exposed! > This, needless to say, does not promote information hiding! > That's not true at all.
-- greeter.e constant greeting = "Hello" procedure say_greeting() puts(1, greeting) end procedure procedure say_who(sequence who) puts(1, who) end procedure global procedure greet(sequence who) say_greeting() puts(1, ", ") say_who(who) puts(1, "!\n") end procedure -- myprog.ex include greeter.e greet("John Doe") puts(greeting) say_who("Jim") say_greeting()
The above code is just an example showing hello.e:4 greeting has not been declared puts(greeting) -- parse error, greeting is undefined. say_who and say_greeting are also invalid. The are not global. > Let me give you a real example. I make it a matter of pride that if you > get a function from me it is complete, works and you will have no problem > adding it to your code. I was writing a utility and needed a function > that a guy I worked with had written. He insisted I use his function. > Being my nominal boss at the time it was difficult to refuse. Anyway, I > added his code to my tiny little utility and there was a problem. It had > ties that were dependant on other parts of his project. So I had to include > those (couldn't amputate because that was the nature of his code.) This > continued until finally my tiny little utility was the size of his major > project. At that point I got my boss involved and let him share some of > my frustration (I'm generous that way.) In the end, I wrote what I needed > without the help of his function. The guy was a really smart guy, but didn't > really understand the concept or why it was important. I find that very > few programmers I've worked with really do. This was not an isolated > incident. Hm, that happens anywhere, even in languages that you would consider modular. That has nothing to do with include or with Euphoria. -- Jeremy Cowgar http://jeremy.cowgar.com