Re: Detecting the Eu version

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

Pete Lomax wrote:
> 
> On Tue, 14 Dec 2004 13:00:38 +1100, Patrick Barnes <mrtrick at gmail.com>
> wrote:
> 
> >If I take a Eu2.5 program and try and run it on Eu2.3, it probably
> >won't work. Fair enough. However, *why* doesn't it work? A *user* who
> >encounters a problem caused by this won't know why it occurs. By being
> >able to *require* a version, the interpreter can stop and say "Error,
> >this program requires Euphoria version 2.5 or newer", which is much
> >more helpful.
> 
> Absolutely, the bugbear being you can achieve this in 2.4 but cannot
> in a theoretical 2.5 vs 2.6 scenario, hence the request to act now.
> 
> Still hoping Rob will at least comment on
> 
> 	with 2.5
> 
> and hoping he will agree the '.' will distinguish it adequately from
> historical stamping statements.
> 

However this only deals with the situation in which the entire program
is incompatible with an earlier version. To deal with the situation
where only part of the code is imcompatible we might additionally need
a run-time function to return the Euphoria version.

I would suggest the machine_func() could be easily adapted for this
purpose, such that we could have something like ...

A new include file, version.e, in the euphoria include folder.

  global function version()
      return machine_func(M_VERSION, {})
  end function

Which would could use as ...
  include version.e
  . . .
  procedure XYZZY()
    if version() >= 2.5 then
       . . . 
    else
       . . . 
    end if
  end procedure

And for people using earlier versions of Euphoria, RDS or others
could easily provide a specialized edition of version.e to cater
for that, such as ...


   global function version()
      return 2.3
   end function

Well, you get the idea...not exactly rocket science. 

-- 
Derek Parnell
Melbourne, Australia

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

Search



Quick Links

User menu

Not signed in.

Misc Menu