Re: Do you currently use namespaces?

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

c.k.lester wrote:
> 
> Matt Lewis wrote:
> > 
> > d,f and g should make certain to include any file they need.  Then, even if
> > your main file doesn't use one of the dependencies, you'll still have 
> > working code.
> 
> That seems to violate DRY... Or doesn't it?

I would argue that it doesn't, or that it's at least a reasonable exception.  
Since both files need depend upon the code, it's just being more explicit 
about things.  

> But, I can see the case for including dependencies. How much more memory
> does this require, or does the interpreter see that I've included something
> earlier and it can just use that copy?

The additional memory is trivial (basically, euphoria remembers who included
whom, so it's an extra integer in a sequence).  The file is only read once.
But this information is used later to determine symbol resolution.

Suppose that someone were using bbcmf and some other library.  Now suppose
that this other library exposed a global symbol that had the same name as
something in one of your files (let's say filed.e).  Under 3.1, if the 
other library were included before bbcmf, you'd get an error when that 
symbol was used in bbcmf, because there would be two globals with that name.

Under 4.0, the parser will see that while there are two symbols, bbcmf actually
included filed.e, but not the other library, so it obviously meant to use
the symbol in filed.e.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu