Euphoric about Euphoria

Euphoria is profound and very interesting. Supported on Windows, DOS, Linux and FreeBSD, it is an interpreted language with some impressive features. For a start, Euphoria is amazingly fast considering that it is interpreted. The Euphoria Web site says that it is 30 times faster than Perl or Python. And there's also a Euphoria-to-C translator that can boost execution speed even further.

"It's the year 2399. The galaxy is dominated by the evil forces of the C empire. Programmers' minds are being enslaved to the C language. Your objective as commander of the Euphoria is to rid the galaxy of the 50 C ships and spread euphoria throughout the galaxy. Forty of these evil ships are regular C ships, 9 are the more powerful ANSI C ships, and a single ship, lurking somewhere in the galaxy, is the extremely powerful and terrifying C++."

- Introduction to the game "Language War" written in the language Euphoria showing the adherents' fervor.

As you might have noticed, here in Gearhead we have a slight obsession with computer languages because your language choices for IT projects will have a huge effect on systems architecture, functionality, maintainability and your sanity. Moreover, one language won't fit all your needs. Sometimes you need a language for big systems stuff, other times you'll need one for ad hoc systems admin stuff, and they likely will be quite different beasts.

Over the past few years we've covered many large-scale and well-known languages, including PerlPython and PHP. We've delved into exotica such as Rebol and Jython. This week, we look at yet another exotic programming tongue that, while it is not well known, actually is supported by an active and vociferous community. The language in question is Euphoria.

Euphoria, the creation of Robert Craig of Rapid Deployment Software in 1993, can be found at www.rapideuphoria.com. Why is it called Euphoria? Because the name is an anagram for End User Programming with Hierarchical Objects for Robust Interpreted Applications. A somewhat labored joke to be sure, but now you know.

Euphoria is, however, profound and very interesting. Supported on Windows, DOS, Linux and FreeBSD, it is an interpreted language with some impressive features. For a start, Euphoria is amazingly fast considering that it is interpreted. The Euphoria Web site says that it is 30 times faster than Perl or Python. And there's also a Euphoria-to-C translator that can boost execution speed even further.

Under the hood, Euphoria is a block-structured language with a line-based syntax and a simple data model that makes it suitable for general application development. In Euphoria, all data elements are either atoms or sequences, which makes it pretty similar to, say, C or C++. Atoms are numeric and include characters, integers or floating point values. Sequences can contain atoms and other sequences and can be any length.

Indexing, slicing and the ability to distribute scalar operations over sequence members (that is, if you multiply a sequence by an integer every member of the sequence is acted upon individually) are all supported, and type checking is built-in. Euphoria enforces sequence-index bounds and function-return values and - this is crucial - there are no pointers! As with C# or Python, the lack of pointers goes a long way to ensure that programming mistakes such as writing over variables and memory bounds are avoided. Euphoria also uses automatic garbage collection so programmers don't have to manage memory manipulation and "memory leakage" (a common problem with C programs) is avoided.

On the down side, Euphoria doesn't support advanced features such as threads, exceptions or higher-order functions, but you can integrate Euphoria code with other languages, call external system APIs or migrate your Euphoria code through translation to C.

Euphoria offers extensive run-time error checking, and if something goes wrong in a Euphoria program at runtime a detailed error message is produced with a call traceback and a listing of variable values.

It also includes an integrated full-screen source-level debugger and tracer, and an execution-count profiler and a time profiler (for DOS32) are available. You can even save programs as stand-alone .exe files!

Third-party support is active with lots of programs and libraries that are typically open source. And the publisher offers a database system for Euphoria that runs on all supported platforms.

So what does it cost? Nothing for the basic version, but for $29 you get full debug and trace, the ability to package programs in .exe form, support for execution-count profiling and time profiling (for DOS32). For another $29 you can get the Euphoria-to-C translator and for $49 more the source of the interpreter. And under all licenses, you can distribute Euphoria program royalty-free.

Take a look at Euphoria and tell us what you think at gearhead@gibbs.com.

Learn more about this topic

Application-development downloads

More tools to play with.
Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.
Related:
Must read: 10 new UI features coming to Windows 10