Re: Detecting the Eu version

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

Lucius Hilley wrote:

> So many of you still don't understand the problem.
> 
> Let's assume that version 2.6 of euphoria introduces the use of % as an
operator
> for remainder.
> 
> }}}
<eucode>
> Current code is:
> 
> puts(1, "2.5 or better")
> atom a
> a = remainder(35, 4)
> 
> ---------
> Example future code could be:
> 
> puts(1, "2.6 or better")
> atom a
> a = 35 % 4
> </eucode>
{{{

> 
> Lets call these C and F for Current and Future.
> The problem with version testing comes from the fact that
> version 2.5 (and probably future versions) parse the entire
> program before execution.
> 
> If you try to run F code on C it will never display the result
> of the puts command because of % being a syntax error.

Why never will ?

1. You can replace  '%'  to 'remainder'.
2. You can update interpreter.
3. You can do:

with ! -- this program runs with 2.6 or better,
          comment these lines if your interpreter
          is 2.6 or better, read docs.
puts(1, "2.6 or better")
atom a
a = 35 % 4


User just ed, comments forced crash and runs you program, if
his interpreter is 2.6 or better, or replaces  '%'  to 'remainder',
if he hates 2.6, then comments forced crash, runs adapted program.

> The interpreter will detect the error before you can run
> ANYTHING.  Including any version testing.  The only
> current method around this is to have 2 programs.
> 
> 1. Program A tests version
> 2. If version good then Program A start Program B
> 3. Program B is the intended program.

Good idea about combined useing of  2.3  or  2.4  and  2.5+.
I like it. Thanks.

[snip]

Regards,
Igor Kachan
kinz at peterlink.ru

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

Search



Quick Links

User menu

Not signed in.

Misc Menu