Euphoria Ticket #977: or_all() for defaulted parameter causes strange error report

This causes an error:

public function HttpGetRequest( sequence url, object accept_types = NULL, atom flags = or_all({ INTERNET_FLAG_RELOAD, INTERNET_FLAG_NO_CACHE_WRITE, INTERNET_FLAG_NO_UI, INTERNET_FLAG_PRAGMA_NOCACHE }), atom flagsEx = 0 ) 

This does not:

public function HttpGetRequest( sequence url, object accept_types = NULL, atom flags = 0, atom flagsEx = 0 ) 
	 
	if flags=0 then 
		flags = or_all({ INTERNET_FLAG_RELOAD, INTERNET_FLAG_NO_CACHE_WRITE, INTERNET_FLAG_NO_UI, INTERNET_FLAG_PRAGMA_NOCACHE }) 
	end if 
 

The error:

c:\eu_include\htf\prefs.e:19 
<0132>:: Syntax error - expected to see possibly '(', not '}' 
	raw = HttpGetRequest( PREFS_URL ), 
	                    ^ 
 
 
--- Defined Words --- 
EU4 
EU4_1 
EU4_1_0 
WINDOWS 
WIN32 
GUI 
X86 
BITS32 
LONG32 
EUI 
------------------- 

Details

Type: Bug Report Severity: Major Category: Interpreter
Assigned To: ghaberek Status: New Reported Release:
Fixed in SVN #: View VCS: none Milestone:

1. Comment by SDPringle 1 month ago

As a work around you can make a constant assignment like this:

constant http_get_request_default_flags = or_all({ INTERNET_FLAG_RELOAD, INTERNET_FLAG_NO_CACHE_WRITE, INTERNET_FLAG_NO_UI, INTERNET_FLAG_PRAGMA_NOCACHE }) 
 
public function HttpGetRequest( sequence url, object accept_types = NULL, atom flags = http_get_request_default_flags, atom flagsEx = 0 ) 

2. Comment by SDPringle 1 month ago

I tried to reproduce this bug by completing your code fragment, but I couldn't. Does the following code trigger the bug with your system euphoric?

enum INTERNET_FLAG_RELOAD, INTERNET_FLAG_NO_CACHE_WRITE, INTERNET_FLAG_NO_UI, INTERNET_FLAG_PRAGMA_NOCACHE 
function or_all(sequence s) 
    if length(s) = 1 then 
        return s[1] 
    elsif length(s) = 2 then 
        return s[1] or s[2] 
    else 
        return or_all(s[1..floor(length(s)/2)]) or or_all(s[floor(length(s)/2)+1..$]) 
    end if 
end function 
 
constant NULL = 0 
 
public function HttpGetRequest( sequence url, object accept_types = NULL, atom flags = or_all({ INTERNET_FLAG_RELOAD, INTERNET_FLAG_NO_CACHE_WRITE, INTERNET_FLAG_NO_UI, INTERNET_FLAG_PRAGMA_NOCACHE }), atom flagsEx = 0 ) 
    return 0 
end function 
 
constant PREFS_URL = "http://www.openeuphoria.org" 
 
constant raw = HttpGetRequest( PREFS_URL ) 
 

3. Comment by SDPringle 1 month ago

I can't test fixes for things that we can't reproduce with the software we have. I suppose it is a development checkout hash verson, is it?

And yes, I know or_all should be implemented with or_bits.

Search



Quick Links

User menu

Not signed in.

Misc Menu