Abstract: This presentation is intended to describe
some aspects of Euphoria, a general purpose computer
language, and how they might be employed within a Information
Systems environment. This paper does not intend to compare
Euphoria to other languages, except where clarification of
distinct features may be required.
Caveat This
document is still very much in development. It is written from
the point of view of a long time user and has not been reviewed
or endoresed by RDS.
Q: What is Euphoria? A: Euphoria
is a modern procedural computer language. It is not a subset
of another language, but it bears comparison to APL, C, and Lisp
derivatives. Euphoria was created in Canada, around 1993, by
Mr. Robert Craig. The latest incarnation (as of April
20th,2005) is version 2.5 and can be found at
HTTP:\\www.rapideuphoria.com
Q: Why do I get funny
looks when I ask my IT guys about Euphoria? A: Euphoria has
become identified commonly as a hobby language. Possibly
because it does not have big ANSI committees deciding what
features should be in the standard, or because Microsoft has not
tried to make a bloated but impotent version of it yet.
Q:
Does Euphoria have xxxx or do yyyyy (read Excel documents,etc...)
?
A: Like all real computer
languages, Euphoria does nothing by itself. It is not an
application. It is a means to develop an application. It puts
control of systems into the hands of a developer to script a
series of actions and conditions. Euphoria supports the running
of external executable via system() calls , and the use of shared
code found in Dynamic link or object libraries. Employment:
So what do we use Euphoria for? Euphoria fits into many roles.
Feature List
Modular design using include
files
Clear English syntax on
multiple line statements, limited reuse of symbols in multiple
contexts
global, private and local
variable scopes.
standard data types- constant,
integer, atom, sequences
Sequence slicing operations,
extensive sequence depth
Platforms- DOS, all 32 bit
Windows , Linux, Free BSD
Control structures –
for/next , while/end while , if/then/else/elsif/end if
sparse reserved keyword list
Syntax checking
Short circuiting of condition
evaluations
Run time options -
with/without trace, warnings , time profile
a royalty free, public domain
interpreter available for free distribution with application
several distribution options -
run time interpreter, binder, C translator
read/write/append to text or
binary files
EDS - a file based DB library with tables and key sorting
on data objects.
Sub topics
General information & sequence concepts:
Euphoria is modular in
design. The base package is very sparse with extended functions
stored in "include" files. Knowledgeable users of
Euphoria have been very generous to contribute a number of
function libraries that extend the base package. These
contributions include GUI functionality for Windows and Linux,
database connectivity, network protocols, e-mail support,
advanced math, image manipulation, object oriented extensions,
and CGI (web server scripting).
Employment:
Programming Euphoria means abstracting all data into one
of two general data types; The atom
and the Sequence. An atom is always
a single numerical value, even when it's used to represent an
alphabetical character. X = 65 Y = 132.7 Z
= 'A' are all assignments of atoms. Variables X and Z are
identical here. Integers are a special type of atom which only
hold whole numbers, that is they do not allow fractional parts.
Integers are mainly useful for counting loops.
A sequence
is constructed of a series of atoms enclosed in
Brackets. {65,66,67,68,69} is a sequence. The atoms in a
sequence may also be expressed as a string of characters, such
as "ABCDE", but this is an illusion as there is no
actual string type. Note the use of double quotes to designate a
character sequence, as opposed to single quotes to denote an atom
value; 'A' is not the same as “A”. it is possible
to express an operation on all members of a sequence such X=
"ABCDE" + 1. The result is not concatenation but an
addition operation on all the elements of the sequence, resulting
in "BCDEF". When performing conditional tests on
sequences, however, you must use special functions
equal(),length() and sequence()
A sequence may be composed of multiple subsequences to
a very large depth. You do not need to dimension a sequence
before assigning to it, though you must declare a variable as
either a type of sequence or a type of object, and you must
initialize it with some value before using an expression on it;
--a
short assignment program sequence A A = ""
print A
Limitations;
You may not poke values into a sequence at an index point that
has not been reached. The following is illegal and will cause the
interpreter to report an error.
Sequence
s s[32] = 0 ? s
To get around this you can
preallocate a sequence structure using repeat;
Sequence
s s = repeat(s,32,{0,0}) s[32] = 0 ? s
Do not confuse the object
type in Euphoria with "Object" oriented
programming. The type "object" denotes a piece of
data that may be either an atom or a sequence. A euphoria
function might return a string of text or it might return an atom
as a flag indicating a condition. Object types are required for
conditional data such as directory information for a file where
the file may not always exist.
atom
df
df =
dir(“myfile.txt”)
the
truth of Euphoria is that there are always better ways to
accomplish things that what conventional thinking would have you
do. This is the hurdle you must jump.
|