1. variable scope
- Posted by katsmeow Feb 18, 2021
- 988 views
Given:
-- == Application Name == object var1 include IncludeName.e
Run with C:\OE4.1.0-x64\bin\eui.exe
Crashes in IncludeName.e because var1 is undeclared.
I have tried export , public , and global , only global works, but i don't want to blast that all over the rest of the program. Apparently, export and public work in only one direction; that is: if i declared var1 in IncludeName.e as public or export, then ApplicationName could see var1.
What am i missing?
Kat
2. Re: variable scope
- Posted by _tom (admin) Feb 18, 2021
- 1057 views
Given:
-- == Application Name == object var1 include IncludeName.e
Run with C:\OE4.1.0-x64\bin\eui.exe
Crashes in IncludeName.e because var1 is undeclared.
I have tried export , public , and global , only global works, but i don't want to blast that all over the rest of the program. Apparently, export and public work in only one direction; that is: if i declared var1 in IncludeName.e as public or export, then ApplicationName could see var1.
What am i missing?
Kat
each include works in one direction only
if you want var1 to be visible in IncludeName.e the you must
- write global object var1
- IncludeName.e must ''include'' the file containing var1
be well
_tom
3. Re: variable scope
- Posted by katsmeow Feb 19, 2021
- 956 views
each include works in one direction only
Thank you for the confirmation, Tom.
I would like to officially add a request for a bilateral include feature, to future OE improvements and releases, if that's possible.
Kat
4. Re: variable scope
- Posted by katsmeow Feb 19, 2021
- 965 views
I just tried something.
If both files which i expect to work together include each other, then the variables i wish both to work on can be available to both using the public keyword, vs the global declaration.
This feature isn't in the OE help files i have.
Kat
5. Re: variable scope
- Posted by _tom (admin) Feb 21, 2021
- 938 views
each include works in one direction only
Thank you for the confirmation, Tom.
I would like to officially add a request for a bilateral include feature, to future OE improvements and releases, if that's possible.
Kat
What you are asking for is a simple old school include statement.
I can see value of this.
What if?
-- extensions .e .ew // invokes the scope rules (as used by either OE or Phix ) include myinc.e -- extension .txt // does not invoke any scope rules include myinc.txt
Including a .txt file would simply paste text into your code.
- this would be good for quick code development
- keeping code segments short
be well
_tom
6. Re: variable scope
- Posted by petelomax Feb 21, 2021
- 921 views
does not invoke any scope rules
I cannot do that. I mean that is totally and utterly beyond my abilities and comprehension. To have any identifier, anywhere, ever, that does not correspond to scope rules is simply not practical, quite impossible, and utterly meaningless.
An "actual paste" would completely mess up line numbers in error messages. In addition, a "second paste" of the same file is guaranteed to trigger compilation errors, like a badly written macro, and I'm strongly opposed to macros, if you want them do your own pre-processing - imnsho, C-based languages get away with macros by simply not providing line numbers on error...
7. Re: variable scope
- Posted by _tom (admin) Feb 21, 2021
- 931 views
Briefly, long time ago, Euphoria 2 allowed you to write a text file and then immediately include it into a running program. RDS quickly fixed this bug.
I know what you want Kat, it is impractical .
be well
_tom
8. Re: variable scope
- Posted by katsmeow Feb 21, 2021
- 892 views
I know what you want Kat, it is impractical .
Like Pete did, first i thought of when reading of the embedding txt files was tracing errors.
Then shouldn't this be in a help file, or it also a bug that needs fixing?
If both files which i expect to work together include each other, then the variables i wish both to work on can be available to both using the public keyword, vs the global declaration.
Kat