1. How can I make some vars visible
- Posted by Algorythm Dec 06, 2008
- 971 views
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
2. Re: How can I make some vars visible
- Posted by SDPringle Dec 06, 2008
- 1012 views
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
3. Re: How can I make some vars visible
- Posted by mattlewis (admin) Dec 06, 2008
- 999 views
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
4. Re: How can I make some vars visible
- Posted by DerekParnell (admin) Dec 06, 2008
- 987 views
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.
5. Re: How can I make some vars visible
- Posted by Algorythm Dec 07, 2008
- 982 views
Shawn, Matt, Derek, thank you very much.