Re: confusion about include
- Posted by DerekParnell (admin) Aug 07, 2010
- 1243 views
In the good old days when Euphoria was simple, 'include' included files for the entire rest of the program. So I could do this:
-- main file include GtkEngine.e include myfile1.e -- GtkEngine.e would be recognized in each of these files. include myfile2.e include myfile3.e -- bunchuv code -- end main file
Now it's different:
-- main file include GtkEngine.e include myfile1.e -- GtkEngine.e must be included in each of these files. include myfile2.e include myfile3.e -- bunchuv code -- end main file
Is there a way to do 'include' in Euphoria 4.0 that works the same way as 'include' in Euphoria 3.1?
If the 'myfile' code is using stuff declared in GtkEngine.e and those declarations are 'public' or 'export' then yes, the 'myfile' files will need to directly include 'GtkEngine.e'.
Remember than the idea behind 'include' files is that these files are assumed to be re-usable modules that can be included into any file that needs access to the module's API. It is generally regarded as bad coding style to have implicit dependencies in a module on symbols declared outside the module. The 'global' concept allows that coding style if you want to use it though.