comp.lang.ada
 help / color / mirror / Atom feed
From: RC <rc1@clanchy.demon.co.uk>
Subject: Re: Ada's Assembly Language Comments
Date: 1997/07/08
Date: 1997-07-08T00:00:00+00:00	[thread overview]
Message-ID: <rNu0QUAYEowzYwIF@clanchy.demon.co.uk> (raw)
In-Reply-To: 33BBD7AC.286F@link.com


>RC wrote:
>> 
>> Why does Ada have only the " -- " assembly language style, in-line
>> comments and not block structured ones as in C or Pascal or better
>> still nested block structured comments as in Modula 2?

Samuel Mize wrote:

>Ada was designed for building highly-reliable, mission-critical
>systems.  They had seen accidentally-unclosed comments consume
>code up to the next comment termination.  They had also seen live
>code accidentally "hidden" by comments, e.g.:
>
>   text of C program appears  /* COMMENT BLOCK */
>   to be over here on the     /* COMMENT BLOCK */ surprise!
>   left side of the listing   /* COMMENT BLOCK */
>
>Requiring matching open/close tokens (as C does not) solves the
>first problem, but not the second.

The second problem isn't one really is it?

If a program is written:

   put (text); new_line;

No one would doubt that the new_line was an active statement.

(*
    A block of comments followed by code
    would be rather a messy style,
    but the meaning is apparent.
*)                                                     new_line;


>How about: Experienced professional programmers have accidentally
>commented out good code and accidentally left in bad code, causing
>system failures.  We're planning to build mission-critical and
>life-critical systems, so we want to eliminate that risk.

Compilers do their best to preclude this, programmers have their own
techniques of minimising their mistakes, making their intentions clear
and testing that the program does what the specification (and the
comments) say it should.

The problems with the *, /, /* and */ symbols in 'C' do exist and (* and
*) are possibly better.  The Pascal alternatives { and } might be better
still.

>> The elegance of user defined stucture of code seems to rather disappear
>> with the "knife and fork" nature of these comments.

>It can be less convenient.  One has to learn how to comment
>appropriately in the new language, rather than just doing things
>the same as in another language.  On the other hand, one has to
>learn how to do MANY things differently.


I agree it can be done, I disagree that the lack of free flowing
comments makes Ada more readable.  I'm sure most programmers have had
compilation errors with comments but doubt that many pass through
undetected.


>Ada is relatively self-documenting, if coded properly.  With good
>identifiers and code structure, I find that line-by-line comments
>are largely self-defeating: they reduce the clarity of the
>program by cluttering the listing.  Most of my comments are blocks
>of text, describing what the following block of code is doing.

Agreed, which is why block structured comments should be allowed to flow
freely.


>I do occasionally miss being able to close a comment, but I never
>miss finding that some idiot has accidentally put a space between
>'*' and '/', and the critical code following that comment isn't
>compiled (but appears on the listing).  I especially don't miss
>being the idiot.


I would suggest that few programmers would accidentaly put a space in
the middle of a lexical symbol.

   if test the n            -- This would be spotted?
        do_something;
   end if;

When spaces appear in the middle of C end comments tends to be when
programmers have "turned off" the comment terminator in a piece of code
which has been temporarily commented out in a way that leaves it
available to be easily turned back on when the code is reactivated.

Proper nested comments would obviate the need for this.

After Ada there are other languages besides C.  Even if there weren't,
the non-existence of a feature does not preclude its possible
usefulness.


RC1




  parent reply	other threads:[~1997-07-08  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-03  0:00 Ada's Assembly Language Comments RC
1997-07-03  0:00 ` Peter Hermann
1997-07-03  0:00   ` Robert Dewar
1997-07-03  0:00   ` RC
1997-07-08  0:00     ` Peter Hermann
1997-07-03  0:00 ` Kenneth W. Sodemann
1997-07-04  0:00   ` Richard A. O'Keefe
1997-07-08  0:00     ` Kenneth W. Sodemann
1997-07-08  0:00   ` RC
1997-07-11  0:00     ` Dan Johnston D.B.
1997-07-13  0:00       ` Robert Dewar
1997-07-11  0:00     ` Robert Munck
1997-07-03  0:00 ` Samuel Mize
1997-07-04  0:00   ` Fergus Henderson
1997-07-07  0:00     ` Tucker Taft
1997-07-08  0:00     ` RC
1997-07-08  0:00   ` RC [this message]
1997-07-11  0:00     ` Stuart Palin
1997-07-11  0:00     ` Joerg Rodemann
1997-07-11  0:00     ` Samuel Mize
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox