Re: Import Code vs Include Code

new topic     » goto parent     » topic index » view thread      » older message » newer message
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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu