axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] RE: Emacs + input syntax


From: Ralf Hemmecke
Subject: Re: [Axiom-developer] RE: Emacs + input syntax
Date: Fri, 12 May 2006 01:43:14 +0200
User-agent: Thunderbird 1.5.0.2 (X11/20060420)

On 05/11/2006 11:46 PM, Page, Bill wrote:
On Thursday, May 11, 2006 1:01 PM Ralf Hemmecke wrote:
I would always suggest to forget about the #pile mode when you program in Aldor ...

Why? Your suggestion seems to me only a kind of
linguist prejudice.

I much prefer this notation. I think it is a strong
point of both SPAD and Aldor that they support it
(SPAD requires it). It is briefer, cleaner and easier
to read.

I don't like it since when I started my first programs in SPAD several years ago I had no Axiom book available. The only source that I could learn from was the source code that I could access through hyperdoc.

Can you imagine how hard it was to figure out how to parse something like

ListAggregate(S:Type): Category == Join(StreamAggregate S,
   FiniteLinearAggregate S, ExtensibleLinearAggregate S) with
      list: S -> %
        ++ list(x) returns the list of one element x.
 add
   cycleMax ==> 1000
   ....

I still do not completely understand that pile syntax. Let me add braces to the code above...

ListAggregate(S:Type): Category == Join(StreamAggregate S, {
   FiniteLinearAggregate S, ExtensibleLinearAggregate S) with {
      list: S -> %
        ++ list(x) returns the list of one element x.
}
 add {
   cycleMax ==> 1000
   ....
}

Well, my braces must be wrong, since it goes ... (...{ ... ) ...}.
There is more to indentation than just starting a new block.
Yes, I probably haven't read the documentation about the spad indentation. And even if I read Section 5.2 of the Axiom book, I would come to the same result (perhaps using parentheses instead of braces).

> What purpose does the extra bracket { ... }
syntax serve if we all agree that "good" programming
practice demands consistent indentation?

My programming experience with SPAD is that I had to compile too many times in order to find out that my indentation was wrong (at exactly such places as above).

I was so relieved when I could switch to braces in Aldor.
And I do indent code, I even wrote an aldor-mode for emacs to help with such indentation. But that mode relies on parentheses, brackets, and braces. It automatically indents to the right amount and I see when there is a forgotten brace, because pressing TAB lead to the wrong indentation.

Can you have automated indentation with #pile mode?

Well, anyone has his preferences...

However, in order to make code readable for future programmers (why should they learn to syntaxes?), we should introduce some coding conventions. And as long as programming the axiom library is concerned, I will fight for braces. ;-)

For the command line of Axiom I don't care at the moment, because that is a task for a good user interface.

Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]