1. HELP! scope or interpreter problem (I think) with include files

I develop on a Linux system using svn3379. Works perfectly. Port to windows vista with a newly loaded version 4.0 I begin to have numerous problems with include files like map.e, prime.e, etc. The error message says that a value internal to the include file has not been initialized. I look at the include code and the variable has clearly been set. Any thoughts as to what I am doing incorredtly> ex.err output.....

C:\euphoria\include\std\primes.e:187 in function next_prime()  
variable list_of_primes has not been assigned a value  
    n = 30 
    fail_signal_p = -1 
    time_out_p = 1 
    i = <no value> 
... called from c:\euphoria\include\std\map.e:385 in function new()   
    initial_size_p = 690 
    buckets_ = 30 
    new_map_ = <no value> 
    temp_map_ = <no value> 
the code from the primes.e file-->

 
namespace primes 
include std/search.e 
sequence list_of_primes  = {2,3} -- Initial seedings. 
--**** 
 

Any and all help appreciated.

Regards, jd

new topic     » topic index » view message » categorize

2. Re: HELP! scope or interpreter problem (I think) with include files

jessedavis said...

I develop on a Linux system using svn3379. Works perfectly. Port to windows vista with a newly loaded version 4.0 I begin to have numerous problems with include files like map.e, prime.e, etc. The error message says that a value internal to the include file has not been initialized. I look at the include code and the variable has clearly been set. Any thoughts as to what I am doing incorredtly> ex.err output.....

C:\euphoria\include\std\primes.e:187 in function next_prime()  
variable list_of_primes has not been assigned a value  
    n = 30 
    fail_signal_p = -1 
    time_out_p = 1 
    i = <no value> 
... called from c:\euphoria\include\std\map.e:385 in function new()   
    initial_size_p = 690 
    buckets_ = 30 
    new_map_ = <no value> 
    temp_map_ = <no value> 
the code from the primes.e file-->

 
namespace primes 
include std/search.e 
sequence list_of_primes  = {2,3} -- Initial seedings. 
--**** 
 

Any and all help appreciated.

Regards, jd

Only think I can think of is that somehow the order of includes and forward referencing are interacting such that a function in std/primes.e that uses list_of_primes is getting called before the main program code - or the top level code of the include file - is run.

The only dependency that I can see is std/map.e depends on std/primes.e depends on std/search.e

It's not obvious to me what you could be doing to cause that error. In that light, it does seem like a bug in 4.0.0

If you can post a simple test case (one that causes the error, and one that'll work after copy&pasting), that would help greatly to finding the cause.

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

3. Re: HELP! scope or interpreter problem (I think) with include files

jessedavis said...

... have numerous problems with include files like map.e, prime.e, etc. The error message says that a value internal to the include file has not been initialized. I look at the include code and the variable has clearly been set. Any thoughts as to what I am doing incorredtly ...

Here is some sample code that will give the error message you mentioned...

object x = next_prime(1000) 
include std/primes.e 


will give us ...

c:\projects\eu_proj\eu40\include\std\primes.e:187 in function next_prime() 
variable list_of_primes has not been assigned a value 
 
... called from c:\temp\test.ex:2 
 
--> See ex.err 
The problem is that you are using a function before the file the declares that function is included, and that included file needs to do some initialization before it can be used.

The workaround is to move the include statement to somewhere before the first use of any of its routines. eg...

include std/primes.e 
object x = next_prime(1000) 

As a general principle, always put your include files near the top of your application code, before your code executes any routine from the included files.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu