Re: Do you currently use namespaces?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Derek Parnell wrote:
> 
> 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?
> 
> 
> > ... 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!
> 
> Ummm ... actually this happens *not* to be the case... The ONLY things that
> are exposed are the symbols explicitly marked as 'global' within the file
> being
> included. For example ...
> 
> If I have a file, exam.e, that contains the following lines ...
> }}}
<eucode>
>  procedure foo()
>  end procedure
>  
>  global procedure bar()
>  end procedure
> </eucode>
{{{

> 
> And another file that includes this ...
> 
> }}}
<eucode>
>   include exem.e
>   foo() -- Fails because it can't be seen 
>   bar() -- Succeeds because 'exam.e' declared it global.
> </eucode>
{{{

> 
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

This means that multiple files have to exchange information through interface
identifiers, since an identifier that is visible in several files is promoted to
interface symbol. This makes it unsafe to break a large body of code into
smaller, more maintainable files, because all exchanges are not supposed to
involve "public" data or routines. And because making public these symbols may
interfere with any application that uses the library.

There ae workarounds as always, but they are neither practical nor 100% safe.

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu