1. Version Feature.

Version feature.
Maybe I am wrong, But I don't think the Euphoria interpreter allows the
program to know which version of the interpreter is being used.
This is rather important considering some of the most recent advances that
have been made.
Examples:
1) x += 1
2) The built-in constand of PI

Because of this our program should be able to realize if it is
attempting to be run with an old interpreter without breaking
the old interpreters.
Simple example:
if EU_VERSION <= 2.1 then
  puts(1, "Requires euphoria version 2.1 or better\n")
  abort(0)
end if

The only problem I see here is that it needs to be implemented
in such a way that it won't break existing code.
The above example would fail because EU_VERSION is never
declared. Also, in versions like maybe 2.2 where EU_VERSION
did exist an attempt to declare EU_VERSION as a constant would
cause that code to fail.  The problem I see is that I don't see how to
make it backwards compatible.  Anyone have any clues?  Maybe Rob can tell us
how to snoop the version.  Maybe we can attempt detection
by the size of the interpreter that is being run?

I still don't see how this will allow us to make programs that can be
supported better under the newer copies of EU yet still be well
supported under older copies.
IE: My intent here isn't in making a program for 2.0 and then making
it backwards compatible for 1.5.
The intent is in making a program in 2.0 and using it to its best ability
and then when 2.1 and 3.0 and so on are released I can update to
support these to their better abilities yet still maintain the ability to
run
under 2.0 if 3.0 isn't being used on that system.  It could also be helpful
in debugging.  IE: user248 says he is having a problem with your
upgrade but everyone else seems to be doing fine with it.  WHY?
The returned debug code.  ex.err would metion that he had run it with
2.0 and you KNOW that your upgrades require 2.1 Then you would be
able to tell that person that they either need to use the old copy or
they should upgrade their copy of euphoria to 2.1

I guess the simpliest method for handling forward and backwards
compatibility might be Rob having a built-in function named version()
if version() < 2.0 then
  put(1, "You need at least version 2.0")
  abort(0)
end if

Again I see old code as crashing out because version() isn't defined.
I wish I could think of a solution for this.

    Lucius L. Hilley III
--Help !!!,   I feel lost.

new topic     » topic index » view message » categorize

2. Re: Version Feature.

On Thu, 28 Jan 1999, Lucius Hilley wrote:

] Version feature.
] Maybe I am wrong, But I don't think the Euphoria interpreter allows the
] program to know which version of the interpreter is being used.
] This is rather important considering some of the most recent advances that
] have been made.
] Examples:
] 1) x += 1
] 2) The built-in constand of PI

Couldn't crash_message() be used in this situation?

Just use:
    crash_message(
        "This program requires Euphoria v2.1\n"&
        "However the problem may simply be a bug.\n"&
        "Please check with the author.\n"&
    {}) -- Maybe insert a contact address here...

HTU,
Carl

Disclaimer: I'm not well today. May be 'flu.
            Hence I may be talking rubbish...

--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail........: cyrek- at -bigfoot.com -- Remove hyphens. Ta :)
URL...........: http://www.bigfoot.com/~cyrek/
Uncrackable...: "19.6A.23.38.52.73.45 25.31.1C 3C.53.44.39.58"

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

3. Re: Version Feature.

Another (related) feature which would be very useful is a conditional
"compile". (I know Euphoria isn't really compiled - but I can't think of =
a
better way to say it).

example:

If platform() =3D DOS32 then
    include graphics.e
else
    include graphics.ew
end if

This feature would complement the version feature suggested by LLHIII.

Colin Taylor

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

4. Re: Version Feature.

Colin Taylor wrote:
>
> Another (related) feature which would be very useful is a conditional
> "compile". (I know Euphoria isn't really compiled - but I can't think of a
> better way to say it).
>
> example:
>
> If platform() = DOS32 then
>     include graphics.e
> else
>     include graphics.ew
> end if
>
> This feature would complement the version feature suggested by LLHIII.
>
> Colin Taylor
The feature exists since EU ver. 2.0 I think.
Have a nice night, Rolf

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

5. Re: Version Feature.

Rolf Schroeder wrote:
>
> The feature exists since EU ver. 2.0 I think.

I got the point now: platform() exists, but 'include'
inside executable statements is forbidden.
Sorry, Rolf

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

6. Re: Version Feature.

Message text written by Rolf Schroeder:
>The feature exists since EU ver. 2.0 I think.<

Yes, platform() exists, but you missed the point.  Try putting an include=

statement inside an "if" statement.  It doesn't work.

Colin Taylor

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

7. Re: Version Feature.

On Thu, 28 Jan 1999 16:02:26 +0100, Rolf Schroeder <schroeder at DESY.DE> wrote:

>Colin Taylor wrote:
>>
>> Another (related) feature which would be very useful is a conditional
>> "compile". (I know Euphoria isn't really compiled - but I can't think of a
>> better way to say it).
>>
>> example:
>>
>> If platform() = DOS32 then
>>     include graphics.e
>> else
>>     include graphics.ew
>> end if
>>
>> This feature would complement the version feature suggested by LLHIII.
>>
>> Colin Taylor
>The feature exists since EU ver. 2.0 I think.
>Have a nice night, Rolf

   Umm,  No this feature doesn't exist.  Yes the routined platform() exists
but you can't include one library or another instead depending on the platform
used.  I agree that platform and version conditionals coding should be possible.
IE:
if version() < 2.0 then
  include special.e
end if
  Yes you can write your code to be platform() specific BUT, It has to
be through out your code not an include this or include that.
IE: We want this BUT.
  if platform() = DOS32 then
    include dos.e--dos stuff
  else
    include windows.ew--windows stuff.
  end if
    The routine names in could be identical but designed for that
platform allowing the code to be platform specific.
A call to input_number() would be a fully featured routine in DOS
where as input_number() could easily be a simple API call in Windows.

IE: We have this.
  sequence s
  if platform() = DOS32 then
    if graphics_mode(261) then abort(0) end if
    -- "Using DOS.  Must use DOS graphics."
  else
    -- "Using Windows.  May use Windows graphical libraries."
  end if

  if platform() = DOS32 then
    pixel(4, {1, 1})
  else
    --Use something similiar in windows.
  end if

  if platform() = DOS32 then
    puts(1, "input a # between 1 and 10")
    s = gets(0)
  else
    -- Use a windows API call.  Looks prettier and
    -- can easily be used to only allow numbers entered.
  end if

-- poke4() and peek4() weren't in 1.4 and I don't
-- recall if they were in 1.5.  If this was possible then a person COULD
-- include patch code so as to allow the program to run on old versions.
    Before poke4() and peek4() were built-in someone built some routines
to handle these cases.  Obviously if the built-in is available you wouldn't
want to use the Euphoria coded routines, because the built-in's are much
faster.

    Lucius L. Hilley III
I hope all this is as clear as mud.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu