Re: Detecting the Eu version
- Posted by "Juergen Luethje" <j.lue at gmx.de> Dec 14, 2004
- 553 views
Dear EUforum members to whom it may concern: Please don't change the Subject of a thread (unless there is an *important* reason)! My e-mail client (and many other clients, too) allows to sort messages by Subject, that makes it much easier to read this mailing list. Also, RDS had built a useful feature into the EUforum web interface: After clicking at the Subject of a message, you'll get the whole thread. Even if you are not interested in these possibilities yourself, other people here find them useful, so do not destroy them! -> I changed "(no subject)" back to "Detecting the Eu version". Jason Gade wrote: > Alan Oxley wrote: >> My reply: >> You said it yourself - if the official is the only release, then the CRC >> won't change? But consider if the convention of "2.5.01" is used, >> or even (possibly less usable) return a string "Euphoria vx.x 12th December >> 2004". >> >> Whats the problem with generating and storing a CRC for every release? There >> are not THAT many! Why would you want to test for future versions, if >> they don't exist..? The reason for testing is to ensure your code is >> compatible with a feature that does not (yet) exist? Sorry, I don't get this. >> Also, there is no reasons why two or more CRC's cannot return the same >> EU version like "2.5" if what the CRC's identify are known bugfixes from Rob. >> >> I'd still like Rob to give us a proper function though, as first prize. >> My suggestion is mostly aimed at testing for earlier releases without >> having to change them. > > The problem is say you use a feature which is included in versions 2.8 > or later. You want to check to make sure you have *at least* version > 2.8. You don't care if the user has 2.9, 3.1 or whatever. Since you > can't tell if the CRC is going to be greater or less than the CRC for > 2.8, you can only check for 2.8 *exactly*. Yes, this is actually the problem when using a CRC, size of the EXE file or something similar for implementing a version() function. There have been much better suggestions in the past though, recently namely by Derek and Pete. However, starting with Eu 2.5, the problem has changed. A version() function -- builtin or not -- wouldn't solve the problem any more. For the Eu 2.5 interpreter (as it currently is) *there is no other way than crashing*, when it will try to run source code that contains keywords which were introduced in Eu 2.6 or later. Whatever code you write in order to try to solve this problem, your code will never be executed, because the program crashes beforehand. This has been discussed previously in this thread. So it might be a good moment now for some people, to test the cool feature that I mentioned above: On the EUforum web interface, click at the subject, and read the whole thread ... > Euphoria is small enough, I think, to include the required interpreter > and files to users. Also, binding or translating would work. For open > source, you would just distribute a source tree like any other > (executable) project would. > > The real problem, of course, comes in distributing libraries that you > don't want to work only for the lowest common denominator. Libraries > are the code that need to check versions somewhat reliably so they can > give a meaningful message to the user of the library. Right! > (Of course, if the library user would read the docs...) Are we talking about a low-level or a high-level language? If Euphoria is a high-level language, then it should for instance say something like: Sorry, code in "thisprog.e" requires Euphoria version 2.5 or later. Rather than: syntax error - expected to see an expression, not an illegal character s = s[2..$] ^ Regards, Juergen -- Have you read a good program lately?