General Euphoria FAQ



1 General questions

1:1 Acknowledgments
This FAQ is developed and maintained by c.k.lester.

1:2 What is Euphoria?
An interpreted programming language for computers running MS-DOS, MS Windows, Linux, and FreeBSD. See the Wikipedia entry for Euphoria.

1:3 Why was Euphoria created?
A: Answer me.

1:4 Show me some Euphoria code.
The standard "Hello, World!" program, in Euphoria:

puts(1,"Hello, world!")


Here is a "delete item" algorithm that deletes an item from a sequence.

global function delete_item( object old, sequence group )
    integer pos
        -- Code begins --
    pos = find( old, group )
    if pos != 0 then
        group = group[1..pos - 1] & group[pos + 1..length( group )]
    end if
    return group
end function



1:5 Why the name 'Euphoria'?
The name "Euphoria" itself is an acronym for 'End-User Programming with Hierarchical Objects for Robust Interpreted Applications.'

1:6 What is the history of Euphoria?
Developed as a personal project to invent a programming language from scratch, Euphoria's first incarnation was created by Robert Craig on an Atari Mega-ST. The first world-visible incarnation of the language was for the 32-bit DOS platform and was released in July of 1993.

1:7 What is Euphoria good for?
A: Answer me.

1:8 Where is the Euphoria Home Page?
http://www.rapidepuhoria.com/

1:9 How much does Euphoria cost?
Euphoria is free, but registration provides advanced developer functionality. Current pricing.

1:10 What are the limitations of the free edition?
A: Answer me.

1:11 How does the Euphoria version numbering scheme work?
A: Answer me.

1:12 Is there a Euphoria newsgroup?
Yes, but it is a ghost town, filled with off-topic messages. Visit the Euphoria Forum instead.

1:13 Is there a Euphoria mailing list/RSS feed?
There is no mailing list, but you can subscribe to the RSS feed here. EuForum is populated with lots of knowledgable and kind Euphoria programmers.

1:14 Are there copyright restrictions on the use of Euphoria?
A: Answer me.

1:15 How do I obtain a copy of the Euphoria source?
A: Answer me.

1:16 How do I get documentation on Euphoria?
At the RDS web site's Documentation Library.

1:17 I've never programmed before. Is there a Euphoria tutorial?
There are several at the moment, with no doubt more to come as Euphoria grows in popularity. Try these for starters:


1:18 How do I get a beta test version of Euphoria?
Any alpha, beta, or current version of Euphoria is available at the RDS Downloads page.

1:19 How do I submit bug reports and patches for Euphoria?
You can submit them to RDS directly, or through the EUforum mailing list.

1:20 Are there any published articles about Euphoria that I can reference?
There are Euphoria articles here, as well as the following:

Euphoria - The Programming Language by Rick Flores and Rick Collins (Gone?)
The Unknown Elegance of Euphoria by Ralf Nieuwenhuijsen
Euphoria Programming Language by Julie Petrusa
FROG Keeps Him Hopping by Ryan Rhodes (about Jonas Temple's FROG program for the IBM iSeries)
Euphoria Review in Monitor Magazine by Paul Smith (August 1997)


1:21 Where in the world is www.rapideuphoria.com located?
Somewhere in Ontario, Canada.

1:22 Are there any Euphoria books?
Yes. There is a list of Euphoria-related books at the official Euphoria web site, here. c.k.lester has written Jubilation:Programming Euphoria and GUIphoria.

1:23 Which editors provide support for Euphoria?
Any programmer's editor will be suitable for writing Euphoria programs. Even Notepad will do, in a crunch. There are also syntax files for a variety of editors so that your code is colorized.

Platform Generic:

    Euphoria's ed by RDS (comes with Euphoria)
    EE by David Cuny.

Windows:

    Edita (written by Pete Lomax in Euphoria!) - Knows Euphoria syntax. Other Euphoria editors written in Euphoria.
    UltraEdit32 - Syntax File
    Crimson Editor - Syntax File
    TextPad - Syntax File at Tommy Carlier's site.

Linux/FreeBSD:

    Kate - Syntax File by Irv Mullins
    

1:24 How do I get help?
If the documentation can't help, and none of the sample code helps, you can always contact the (very helpful and friendly) mailing list or post a message at UBoard.

1:25 What resources are available for new Euphoria programmers?
The best start is with the Euphoria documentation. Very comprehensive and easy to understand.

Jubilation:Programming Euphoria is an ebook geared towards beginners.

Newbies can get one-on-one mentoring at UBoard.

Chris Burch and Derek Parnell each have Euphoria tutorials.

1:26 Can I code and distribute desktop applications to people?
Yes, and easily! There are two options. Binding and Translation to C.

1:27 Is Euphoria interpreted or compiled?
Interpreted.

1:28 How can I get Vim to indent Euphoria code?
A: Answer me.

1:29 What does Euphoria Wiki use as a backend?
Euphoria Wiki is a project in the works that will use Euphoria as its backend. Of course.

1:30 Who can answer the pending questions on this site?
Anybody.

2 How Does Euphoria Stack Up Against...?

2:1 How Does Euphoria Compare With Python?
A: Answer me.

2:2 Euphoria versus other high-level dynamic languages
A: Answer me.

3 Euphoria in the Real World

3:1 How stable is Euphoria?
Euphoria is stable enough to be used in corporate IT departments. Each version of Euphoria goes through rigorous alpha and beta testing phases before a final version is released.

3:2 How many people are using Euphoria?
That's hard to tell, considering that Euphoria is available from a variety of untracked sources. Download.com does track downloads, and shows over 30,000 downloads for Euphoria. The mailing list also has over 500 members, although only a small fraction are active.

3:3 Have any significant projects been done in Euphoria?
Yes. Two in particular are Cloak and Rhyme & Verse from Insight-Concepts. Another is Jonas Temple's FROG. Jonas has even had media coverage.

3:4 What new developments are expected for Euphoria in the future?
A: Answer me.

3:5 Is it reasonable to propose incompatible changes to Euphoria?
A: Answer me.

3:6 Is Euphoria Y2K (Year 2000) Compliant?
A: Answer me.

3:7 Is Euphoria a good language for beginning programmers?
A: Answer me.

4 Installing Euphoria

4:1 Where can I download Euphoria?
http://www.rapideuphoria.com/v20.htm

4:2 What operating systems support Euphoria?
MS-DOS, Windows, Linux, and FreeBSD. For more information, see here.

4:3 How do I install Euphoria?
Download the appropriate file for your OS here. If you are running Windows, you'll simply run the setup program. With Linux, you will extract the files to a directory. See here for more details. A beginner's guide to setup from Chris Burch can be read here.

4:4 Where can I get Euphoria sources?
A: Answer me.

4:5 Can I get to the development source tree?
A: Answer me.

4:6 How do I compile Euphoria?
A: Answer me.

4:7 How do I tell Euphoria where my libraries are?
Set the environment variable "EUDIR" to point to your Euphoria directory. You can also set "EUINC" to point to as many include directories as you like.

4:8 Are precompiled binaries available?
A: Answer me.

4:9 What's all this 'cygwin', 'mingw', and 'djgpp' stuff?
A: Answer me.

5 Euphoria's Design

5:1 Why isn't there a switch or case statement in Euphoria?
Euphoria uses the if...elsif...end if code structure for case branching. A switch/case statement would not be much easier to read.

Extra answer found.

5:2 Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?
A: Answer me.

5:3 Can Euphoria be compiled to machine code, C or some other language?
Euphoria source files can be translated to C using the Euphoria-to-C (e2c) translator. You specify whether you want an executable or a shared library and for which compiler you want the C source to be output. Then you use emake to compile and get your .exe, .dll, or .so file. Supported compilers are OpenWatcom, Borland, Lcc and DJGPP. (1)

5:4 How does Euphoria manage memory?
In a transparent way, using copy-on-write to manage private variables. This is good if you do not wish to delve into this black art.

Euphoria has the following low level routines in order to manage memory by yourself:
  • peek(address): retrieve the byte at this address

  • peek({address,length}): retrieve length bytes starting at address, and returns the sequence made of these bytes.

  • peek4s: same as above, with signed dwords instead of bytes. Signed dwords may overflow a variable of the integer type; use atoms instead.

  • peek4u: same as above, but returns unsigned dwords instead.

  • poke(address,value): sets the byte at address to value. If value is a sequence, the bytes it holds are written in memory starting at address.

  • poke4: same as above, but the values are dwords instead of bytes.

  • allocate(size): allocates a memory block size byte long and returns its address as an atom. You have no control over the way the address is generated.

  • allocate_string(someString): allocates storage for a sequence of bytes plus a trailing 0x00, and returns the address the string was stored at.

  • mem_copy(target,source,length): copies length bytes to target, starting from source.

  • mem_set(source,value,length): sets length bytes to value, starting from source.

  • free(address): release the memory previously allocated at address.
There are also allocate_low(size) and free_low(address), which are specifically designed for DOS and deal with addresses in conventional memory.

Setting up a full fledged memory management system in Euphoria may be possible, but there are restricted areas, like how memory blocks are allocated or how and where (all mixed up on the heap) sequences are stored. Use C if you want to go to this level of detail, and pay the price in development time. This is a good alternative in some rare cases only. Not for the faint of heart.(1)

5:5 Why isn't all memory freed when Euphoria exits?
This may happen under Windows if you didn't carefully release all resources (fonts, bitmaps, DCs and other related stuff) on exiting your application. Windows doesn't do this cleanup automaticaly, nor provides tools for doing so.(1)

5:6 How do you specify and enforce an interface spec in Euphoria?
A: Answer me.

5:7 Why is there no goto?
This discussion pops up every once-in-a-while on the EUforum mailing list. Here's what Rob Craig, the designer/maintainer of Euphoria, had to say about it:

I'm not religiously opposed to goto. There are some gotos coded into the C source of the interpreter, and at one point in the early days I even had one of the "between routines" gotos that are possible in C using setjmp()/longjmp(). It proved to be nightmarishly hard to understand and maintain so I took it out.

I agree that a specialized goto (or special "exit") to get out of a nested loop is probably less clumsy than setting up artificial state variables. I just don't think that this occurs often enough, or causes enough pain to warrant a new language feature, such as labelled statements and a special kind of exit.

The normal sort of gotos, that let you jump around within a routine are like cigarettes. One or two, once in a while, will not harm you. The trouble is they become addictive. If you never start using them, you will never have a craving for one.

When I had to maintain code written by someone else, the sight of a heavily goto'd section of code would really be discouraging. The guy who wrote the goto's probably had some idea of what the control-flow was supposed to be, but I had to struggle to get the same picture into my head. Standard control-flow statements, like for..end for, if-elsif-else etc are much easier to digest and reason about.

And in another email, he stated the probabilities of goto being added to the language.

Since some people think I should come out of hiding and voice an opinion on language design proposals, here's my current thinking about goto.

1. completely general goto, including jumps between routines: 0% chance

2. goto within a routine: 0.01% chance

3. specialized goto to break out of nested loops: 1% chance

Finally, on the likelihood of being bribed:

I've stated many times in the past that I am firmly opposed to adding a goto statement. You'd have to pay me a million dollars (real U.S. dollars, not 62 cent Canadian dollars).



(1) Thanks to CChris for help with answering these questions.