Re: Do you currently use namespaces?

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

CChris wrote:

> 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.

By "public" I assume you mean "able to be directly referred to by code that is
outside the declaring file". However, it has to be done that way if you want to
directly refer to an entity by name - the name must be visible for your code to
'see' it. If you prefer indirect references, you can get away with not knowing
the entity's real name but at a performance overhead or via an alias symbol. An
alias is not a solution because its still a visible name.

Also, the "public" access to data and not routines is the major problem with
module coupling. With routines, one publishes the API and (try to) keep the API
unchanged. Meaning you should be able to move the routine to a new module and not
break the code using it.

I assume that when you say "interfere with any application" you are referring to
naming conflicts. This, as you well know, is what is being addressed in v4.0.

Of course, one further way to restrict naming conflicts is to reduce the
visibility of symbols. 'global' makes it seen by all including levels, even if
they don't need to see it. One suggestion being kicked around is to allow
'global' items to only be seen by the file directly including it. Discussion
continues on this front.


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

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

Search



Quick Links

User menu

Not signed in.

Misc Menu