1. How can I make some vars visible

Hello, Eu programmers.

How can I make some variables (or constants etc.) declared in one file, visible in other file included by former file?

--A.e 
include B.e 
public atom X 

In this example, how can i make X visible in B.e?

Thanks, Algorythm algorythm at yandex.ru

new topic     » topic index » view message » categorize

2. Re: How can I make some vars visible

replace 'public atom X' with 'global atom X.' Most of us would discourage this, though. Alternatively, you can put 'public atom X' into a vars.e file and include vars.e everywhere you want access to it.

Shawn

new topic     » goto parent     » topic index » view message » categorize

3. Re: How can I make some vars visible

SDPringle said...

replace 'public atom X' with 'global atom X.' Most of us would discourage this, though. Alternatively, you can put 'public atom X' into a vars.e file and include vars.e everywhere you want access to it.

Please don't make it global. Instead, add include A.e to B.e. This is one of the key benefits of the forward referencing features of euphoria. In the past, you would have had to move the declaration of X to above the include file, or B.e wouldn't have been able to see it.

Now, if a file has an include directive, it's guaranteed to see all of the appropriately scoped symbols.

Matt

new topic     » goto parent     » topic index » view message » categorize

4. Re: How can I make some vars visible

mattlewis said...

Please don't make it global. Instead, add include A.e to B.e.

Or to put another way, if a file needs to see a (public/export) symbol declared in another file then simply include that other file.

new topic     » goto parent     » topic index » view message » categorize

5. Re: How can I make some vars visible

Shawn, Matt, Derek, thank you very much.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu