1. Import Code vs Include Code

Does Euphoria have a provision for importing source directly into a namespace/scope?

For example:

-- mycode.e 
if length(mySeq) then 
  puts(1,"Yes I can!") 
end if 
 
-- main.e 
 
string mySeq = "Can you see me?" 
 
import mycode.e -- pull this code as though it exists right here so it can see mySeq 
new topic     » topic index » view message » categorize

2. Re: Import Code vs Include Code

euphoric said...

Does Euphoria have a provision for importing source directly into a namespace/scope?

For example:

-- mycode.e 
if length(mySeq) then 
  puts(1,"Yes I can!") 
end if 
 
-- main.e 
 
string mySeq = "Can you see me?" 
 
import mycode.e -- pull this code as though it exists right here so it can see mySeq 

No import keyword.

In your include file "mySeq" has to declared and defined.

This is traditional Euphoria thinking. Everything is declared before use.


if you make mySeq global for example, the included file will recognize it

-- main.ex 
global sequence mySeq = "Can you see me?" 
 
include mycode.e 
-- mycode.e 
 
if length(mySeq) then 
    puts(1, "Yes I can" ) 
end if 

_tom

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

3. Re: Import Code vs Include Code

_tom said...
euphoric said...

Does Euphoria have a provision for importing source directly into a namespace/scope?

if you make mySeq global for example, the included file will recognize it

Yeah, I figured global might have to be the way to go. I just don't want to clutter up that global space.

Oh, well! Maybe in Euphoria 5.0! (I should make a ticket.)

BOOM!

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

Search



Quick Links

User menu

Not signed in.

Misc Menu