1. include files observation and question

Euphoria 4.00.05 on Windows 7 pro:
I program in chunks - modules - whatever. This is for convenience and to lower confusion. Nearly everything is done either by a procedure or a function. As procedures are developed and tested they go into a file. Things being worked on are in another file. There may be a file devoted to gui parts and one to service routines. There is one main file with all the "up top" stuff that includes globals and other definitions. These files are tied together with includes, namespaces, etc so that I only run the file called "main" and everything else tags along. This usually works great; however, I have noticed that as the number of lines of code grows the behavior becomes flaky. Things that once worked fine now have problems that cannot be explained, by me at least. Example: I am working on a data manipulation program that deals with financial data, orders, etc. It has a gui interface for the user. It's not big - about 1500 lines of code with a half dozen windows and, say, 300 controls. It uses the Euphoria database system and numerous map structures to hold the data while it is being processed. It uses win32 gui on Windows 7 operating system. Everything goes through the euphoria interpreter OK. After about 1200 lines of code some of the gui controls that had been working OK stopped working. I chased this for quite a while. In desperation I tried a long shot. I appended all the relevant source files together into one file and removed all the redundant includes. The program ran the first try and everything, even the broken stuff, was OK.
Does anyone out there have any experience with this? Any thoughts?

Thanks, in advance,

jd

new topic     » topic index » view message » categorize

2. Re: include files observation and question

Hi

Yes. My solution was to make sure every single sub file includes every single file that it needs to include, and make sure that includes are never more than one deep. May have been overkill, but I never had a problem after I did that.

Out of interest, were those stumbling blocks caused by (or appeared with) modules you created yourself, or includes downloaded with euphoria or from the archive (eg Win32lib)

Cheers

Chris

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

3. Re: include files observation and question

Thanks for the quick reply.
It's good to know that I'm not alone in this. In answer to the questions, the most recent problem mainly involved the w32library, especially the control handlers where routine_id()s are passed around; however, I have known this to happen only with routines I have written. I generally use only euphoria supplied include files and the w32 library, everything else I write.

Thanks & Regards, jd

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

4. Re: include files observation and question

Hi

Yes, does look like a scope issue rather than a bug. Sometimes the behaviour of the 'global', 'export' and 'public' keywords is slightly different, but as I said this goes away when you inlude only one level down. You just have to be a bit careful when naming routines and variables (or use the namespace qualifier). The problem becomes more complex the more include files you have.

This is quite a good article.

Cheers

Chris

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

5. Re: include files observation and question

ChrisB said...

Hi

Yes, does look like a scope issue rather than a bug.

I disagree. If this were a SCOPE issue I would expect errors to show up when the interpreter runs. There were no errors reported at any time. Also, when the included files were physically assembled into one big source file, along with the 'main' or top file, it ran fine, no complaints. If there were scope problems I would have expected the scope problem to follow into the new single source file. One problem was that calling a procedure that is in an included file from another included file procedure sometimes failed, without any error notice. Just nothing happened. I use namepaces. Inclusion is (usually) a relatively simple process. Just stick the code in place of the include statement (with appropriate adjustments for name spaces).
I have read the article you cite. I use only the simplest case. Included files contain only procedures and functions. No other declarations of any kind outside of the procedure or function.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu