1. Import Code vs Include Code
- Posted by euphoric (admin) Sep 23, 2019
- 836 views
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
2. Re: Import Code vs Include Code
- Posted by _tom (admin) Sep 23, 2019
- 847 views
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
3. Re: Import Code vs Include Code
- Posted by euphoric (admin) Sep 23, 2019
- 829 views
_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!