Re: private include files

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

Patrick Barnes wrote:

> On Mon, 11 Oct 2004 21:39:56 -0700, Derek Parnell wrote:
>
>> Has anybody got any thoughts about extending the 'include' system so
>> that anything included can only been 'seen' by the file that included it.
>
> It's been brought up before... but nothing has happened of it.
> Are there any technical problems with implementing it, Rob? That is to
> say, the visibility...
>
>>    private include abc.e
>>
>> then only the file that has that line can see the 'globals' that are
>> defined inside "abc.e". So if another file wants to see them they also
>> have to explictly include "abc.e".
>
> Indeed, that is perfect (or maybe 'include private').
> If Euphoria did not have to be backwards compatible, I would say
> 1-level inclusion like this  should be the default behaviour. (with an
> 'include global' or something)

Agreed!!
We already have
-        function/procedure foo()
- global function/procedure foo()

-        object bar
- global object bar

So
-        include myfile.e
- global include myfile.e
would be pretty much consistent.

Also, it reads in refman_2.htm, 2.4.2 Scope (Euphoria 2.4):
"Euphoria encourages you to restrict the scope of symbols."

I don't know what implementing a 'private include' would mean for RDS,
how much work, how many problems would arise. But from the Euphoria
programmer's point of view, I think this is actually important.

I would even go so far to say, that backwards compatibility is not so
important here. 1-level inclusion should actually be the default
behaviour, IMHO (see quote above). I don't think that this could cause
any dangerous effects to old programs, CMIIW.
And it will not take too long to replace all "include" with "global
include" in old files, using a good tool.

> The 'private include' would make namespacing problems so much easier, too...
>
>> This is just a quick spur-of-the-moment thought, so it probably has
>> got issues with it.
> Not that I can see... certainly no logical problems to it. As long as
> it's not too difficult to implement, Rob, DO IT! smile
>
>> It would certainly help me with many of the projects I'm working on.
> And mine, too...

Regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu