Re: What else?

Arthur Chance (Arthur.Chance@Smallworld.co.uk)
Wed, 26 Jan 94 14:31:07 GMT

Guido writes:
> I can imagine one difference -- maybe Magik is privately owned and the
> source guarded like a major trade secret? Or am I underestimating
> your intelligence? :-) In any case, if you have pointers (on-line
> preferred :-) to information about Magik, I'd be grateful.

Given my current lack of sleep, underestimating my intelligence is
probably impossible :-( But yes, it's privately owned. However, it's
not a *major* trade secret, it's just that our business is the GIS
(Geographic Information System for those who've not met the term).
Magik simply exists to support the product - we couldn't find any
language suitable for what we wanted at the time we set up the company
(late 1988), so we invented one. As a (very) rough approximation, Magik
compares to Python like Common Lisp compares to Scheme - it's a
`kitchen sink' system, with an X interface and database facilities,
plus zillions of classes as standard. Not the ideal way to do a
language per se, IMO, but ideal for our product. There's nothing online
you can get at at the moment, but I'll see about getting you
something.

> Regarding a better keyword instead of 'else', how about 'finally'? It
> has the advantage that it's already a reserved word. I'm always very
> reluctant to add new words, 'lambda' was the first new one in years I
> believe. I could even introduce a syntax which supports both 'else'
> and 'finally' very easily, and simply change all the documentation and
> examples and library code (I have to think about an automatic fixing
> script since the head of the loop may be arbitrarily far away).
>
> One potential problem with finally: in another context it means "do
> this regardless of what happens", while on a loop the finally clause
> won't be executed when it ls left via a break (or return or
> exception).

We use `protect' ... `protection' where Python uses `try' ...
`finally', and only use `finally' in loops, so don't have this
problem. My personal feeling is that having two subtly different
meanings for `finally' would violate the Principle of Least Surprise (I
wish I could remember who invented this term), so is undesirable. As
the use of `else' with loops is very rare and you want to avoid extra
reserved words, why not just install large red flashing lights in the
relevant section of the manual and leave the syntax alone? After all,
any new language is going to have _some_ surprises w.r.t the languages
one already knows. (We don't want all languages to have line numbers
and data divisions :-)

I also have a sneaking suspicion that I've met another language that
used `else' at the end of a loop, a long time ago, but can't remember the
details. I've got a feeling it was one of the Algol variants around in
the early 70s, maybe Algol-W or Algol-X, or something like that. Think
it was mainly a teaching compiler and ran on IBM 360s (boo, hiss). My
memories of that period tend to be a bit vague though.