Re: 4.0 include system question

new topic     » goto parent     » topic index » view thread      » older message » newer message

Travis,

When you include a file with exports, the exports are included into the current file only. This is to reduce cluttering the namespace and make programs better organized (i.e. where did function abc() come from that I am using in this file?)

So, let's say you have:

-- support.e 
export function supporting_func() 
 
-- mylib.e 
include support.e 
 
? supporing_func() 
 
-- myprog.ex 
include mylib.e 
supporting_func() -- Error! 

Now, you can solve that 1 of two ways. If your library has all sorts of unrelated helpful routines, such as the standard library ... i.e. text, search, primes, io, etc... then you can have your users do:

include support.e 
 
? supporting_func() -- good 

Now, you are developing a GUI library, IIRC, so you may want to make a generic include equity.e:

-- equity.e 
 
export include support.e 
export include other.e 
export include johndoe.e 
 
-- myprog.ex 
include equity.e 
 
? supporting_func() -- Good! 

The "export include" not only includes functions, but passes on the exported items from the include onto the current file's parent.

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu