About Euphoria, from a newcomer

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

My first language was ALGOL 60, learnt in... 1974 (time flies). The
second
was Simula 67, which I discovered three years later. Then (it must have
been around 1980) I had to learn a strange dialect of BASIC, because
that was what my first personal computer came with (a  Kaypro II, with a
Z80 CPU, running CPM, a gigantic 64K of RAM, two floppy drives. No hard
disk of course). That BASIC was so full of bugs that I spent $180 on a
C compiler (BDS-C). Soon after, a American colleague gave me a copy of
Turbo Pascal, and that was so good that I bought a legit copy, and stuck
with Turbo Pascal ever since, however much I missed the features of
Simula. I could do more in an hour on my Kaypro II with Turbo Pascal
than I could in a day on the University's DEC KL-10 in Simula 67. So I
had to give up Simula, reluctantly. Forays into C++, Forth, Modula, even
Ada, did not sway me. Delphi put me right off. I was eyeing Oberon when
I discoverd Euphoria late last year (I forgot how and where).

It was the absence of the infamous Borland 64K limit and the automatic
garbage collections that had caught my eye.

I ran the benchmarks. With some, Euphoria was as fast as Borland Pascal,
with others, it was seven times as slow. But hey, I had just replaced my
aging 486DX50 with an AMD K6-200, so anything I wrote in Euphoria would
run about as fast as on my 486. Nevertheless, I held back. Old habits
die hard, and when you have been programming in Turbo Pascal for
eighteen
years... Coming from ALGOL and Simula, it had taken me a short afternoon
to start programming in Turbo Pascal, so good the old manual was. No
such luck in Euphoria. Admittedly, and I know that because I have been
into human factors for years, a good manual is the most difficult thing
to write, so I am not bitching about that.

Eventually, last week, I took the plunge. It took me two full days. I/O
was bad, but I/O is *always* the big problem. As for the rest, it was
easy, just a matter of forming the right habits. Compared with C,
Pascal, or BASIC, Euphoria *is* strange, all the more so that the
strangeness is hidden under a familiar-looking syntax.

No pointers? I don't believe it. I suspect that Euphoria is *all*
pointers. Except perhaps constants (and even so, I wonder: could they
be read-only variables?). Now for what I like.

Being warned of uninitialized variables. What a marvellous bug killer!
ALGOL and Simula intialize variables to zero on entering a block. Not
bad, but this is better. When I think that the luminaries at Borland
never thought of implement such a simple feature in their Pascal or C,
it makes me wonder.

No BEGIN ... END  (or {...} for you C writers), but instead if...end if,
while...end while, for...end for, etc. First, this eschews the need for
a
special syntax for compound statements. Second, matching an "end" is so
much easier: you know what to look for, "if", "for", "while",
"procedure", "function". In Pascal and C you have to wade backwards
for the matching BEGIN or {, and woe unto you if you have made a mistake
indenting your code!

In C and Pascal statements are terminated or separated by
semicolons. In Euphoria, there is no need for such delimiters, because
it is the very syntax of the statements that tells their limits.
Brilliant.
I have often caught myself swearing at the need for those semicolons
when moving statements about. "There has to be a &^%$#! better way!".
Yes, there had to be, Euphoria has it.

The include files (*.e). Much cleaner, and require much less typing
than, say, the Turbo Pascal units.

Finally, this, about which I am in two minds.

Arguments to functions and procedures can only be passed by value. That,
to me, is the strangest feature of Euphoria. Totally unexpected, and it
took me a few minutes to recover. It is strange. The use of procedures
would thus be limited to output...? I don't mind, but it is strange.
I would expect to be able to output to a sequence as well, in place of
a file (or the screen). But then, you will rightly object, that is done
by using a function returning a sequence (e.g. append). In a picky mood,
I'll say, "all right, a file is a sequence too, so, logically:
  myfile = append(myfile,someStuff)"
I know, I know, I/O is the Achilles' heel of computing. So ignore this
last
paragraph, I was only thinking aloud to myself.

More later perhaps

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

Search



Quick Links

User menu

Not signed in.

Misc Menu