1. variable scope

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

new topic     » topic index » view message » categorize

2. Re: variable scope

katsmeow said...

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

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

3. Re: variable scope

_tom said...

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

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

4. Re: variable scope

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

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

5. Re: variable scope

katsmeow said...
_tom said...

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

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

6. Re: variable scope

_tom said...

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...

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

7. Re: variable scope

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

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

8. Re: variable scope

_tom said...

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?

katsmeow said...

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

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

Search



Quick Links

User menu

Not signed in.

Misc Menu