comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <bmoore.ada@gmail.com>
Subject: Re: Why .ads as well as .adb?
Date: Thu, 6 Jun 2019 08:41:27 -0700 (PDT)
Date: 2019-06-06T08:41:27-07:00	[thread overview]
Message-ID: <ac77dfd5-28cb-42fc-836a-a1b10c46f020@googlegroups.com> (raw)
In-Reply-To: <f68aa6c9-111b-482e-b41b-9ec0fcc76b16@googlegroups.com>

On Thursday, June 6, 2019 at 1:29:30 AM UTC-6, Maciej Sobczak wrote:
> > > This style is promoted by all industrial coding standards (both
> > > C and C++ language standards examples, MISRA-C, JSF, HICPP, AUTOSAR,
> > > ...), so I don't get the argument about "rarity".
> > >
> > > Actually, I don't even know where to find something different.
> > 
> > The two most common layouts for C code are:
> [...]
> 
> Of course. But as pointed above, the vertically-aligned braces are promoted by all industrial coding standards and are used in code examples of the language standards themselves. And I see them in classic books. And I see them in major open source code bases.
> Hence my comment about the argument that "most" C code is smushed together. I just don't see that. (But I know Java coders who, when forced to put their dignity aside, would actually write C code this way.)
> 
> In either case (in both styles) the argument that "Ada's comb" is superior is just not convincing. Which might explain why every new programming language either adopts C-style braces or resigns from distinct bracketing altogether. The subsequent argument that the whole world is idiots would not be convincing, either - this apparently is an inherent property of our visual system that delimiters need be visible enough to be noticed, but should not dominate over the actual (delimited) content.
> 
> Note: sentences are delimited by dots. Just like the sentence you are reading right now. And parts are delimited by commas, just like, you know, the parts of this very sentence.
> And it worked for ages. And we are used to it so much that we would refuse anything different.
> 
> Why?
> 
> Because our very brains are wired exactly to expect that.
> 
> Do you think it would be better to have delimiters and separators that areQWERTY you knowQWERTY so bigQWERTY that they take significant part of the spaceQWERTY with huge terminatorsQWERTY tooQWERTY so that we can see them betterASDFGHJ?
> 
> I don't think soASDFGHJ.
> 
> ;-)

I think you are somewhat comparing apples and oranges here. A sentence in English is more comparable to a statement in Ada. The delimiter for statements in most programming languages including Ada is a semi-colon, which is a single character. I'm guessing semi-colon was chosen over period, as it is less ambiguous for floating point declarations, and otherwise is more noticeable with similar semantics in English.

More comparable to a declarative region in English text is the section title as can be found in outline paragraph titles, and in chapter titles.

Often such declarations provide some sort of number to uniquely identify the section of text, and a descriptive name that describes the text to follow.

For English text, some simplications can be applied, since typically all "declarative regions" are declaring the same variables of the same types, with different data for the object instances. A numerical section id, and a textual short description. In programming languages, these declarative regions are more complex typically, and more critical to understanding the text that follows. 

Typically such declarative regions are further distinguished with preceding blank space including a carriage return, possibly a new page, a unique (larger) font, and then followed by a carriage return, and more blank space.

Pick any book off your bookshelf, you'll likely see this same pattern.

If we truly believe that shortening the "syntax" of these declarative regions is a good idea, then we should eliminate the carriage returns, blank space, font changes, etc from the document sections and chapter headers of all the literature.

1.0 intoduction It was a dark and stormy night, ... 2.0 the early years Way back in the old days...
;-)

Having a longer sequence of text in the syntax for paragraph titles, even if only blank space, can be helpful. Some authors add to this with syntax including the word "Chapter" for example. It doesn't necessarily add a lot of clarity for the reader, but isn't considered annoying either.

I think a bigger issue is using the same syntax for multiple constructs. In languages like C, you typically need to use comments to label end braces for deeply nested code to assist readability. And comments can be misleading. In Ada, different constructs use different (but similar) syntax, such as "end loop", "end select" end {subprogram name}, with optional block labels, which aids the reader in understanding which declarative contruct is ending. And with optional labels also allows the compiler to confirm that what the reader sees matches what the compiler sees. 

Brad

  parent reply	other threads:[~2019-06-06 15:41 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-02  0:48 Why .ads as well as .adb? John Perry
2019-06-02  5:42 ` J-P. Rosen
2019-06-02  6:39 ` Dmitry A. Kazakov
2019-06-03  7:35   ` Maciej Sobczak
2019-06-03  7:57     ` J-P. Rosen
2019-06-03 19:49       ` Keith Thompson
2019-06-04  8:03       ` Maciej Sobczak
2019-06-03  8:13     ` Dmitry A. Kazakov
2019-06-03 19:51       ` Keith Thompson
2019-06-03 20:18         ` Dmitry A. Kazakov
2019-06-04  8:24       ` Maciej Sobczak
2019-06-04  9:33         ` Dmitry A. Kazakov
2019-06-05  9:04           ` Maciej Sobczak
2019-06-05 12:48             ` Dmitry A. Kazakov
2019-06-05 17:12               ` G. B.
2019-06-05 18:50                 ` Optikos
2019-06-05 22:57                   ` Randy Brukardt
2019-06-04 22:28         ` Randy Brukardt
2019-06-05  8:28           ` Maciej Sobczak
2019-06-05  9:20             ` J-P. Rosen
2019-06-05  9:28               ` Paul Rubin
2019-06-05 10:11                 ` Niklas Holsti
2019-06-05 12:58                   ` Maciej Sobczak
2019-06-05 14:28                     ` Niklas Holsti
2019-06-06  7:34                       ` Maciej Sobczak
2019-06-06 19:51                         ` Keith Thompson
2019-06-06 20:27                           ` J-P. Rosen
2019-06-06 21:12                         ` Randy Brukardt
2019-06-06 21:17                         ` Randy Brukardt
2019-06-06 22:08                           ` Dennis Lee Bieber
2019-06-07  7:59                           ` Maciej Sobczak
2019-06-07 10:42                             ` alby.gamper
2019-06-07 16:59                               ` Dennis Lee Bieber
2019-06-07 14:10                             ` Brad Moore
2019-06-07 23:37                               ` Paul Rubin
2019-06-08  1:16                                 ` Brad Moore
2019-06-08  7:34                                   ` Simon Wright
2019-06-08 17:44                                 ` G.B.
2019-06-08 21:41                                 ` Keith Thompson
2019-06-09  0:40                                   ` Paul Rubin
2019-06-09 18:56                                     ` Keith Thompson
2019-06-09 20:35                                       ` John Perry
2019-06-09 21:15                                         ` Niklas Holsti
2019-06-09 22:37                                           ` John Perry
2019-06-10  9:01                                             ` Simon Wright
2019-06-10 13:15                                               ` Simon Wright
2019-06-10  9:22                                             ` Niklas Holsti
2019-06-09 21:37                                         ` Simon Wright
2019-06-09 22:40                                           ` John Perry
2019-06-10  9:07                                             ` Simon Wright
2019-06-09 21:46                                         ` Niklas Holsti
2019-06-10 17:11                                         ` Dennis Lee Bieber
2019-06-08  4:57                             ` Randy Brukardt
2019-06-08 23:57                               ` Optikos
2019-06-09  0:43                                 ` Paul Rubin
2019-06-10  8:17                               ` Maciej Sobczak
2019-06-10 19:10                                 ` G.B.
2019-06-10 22:07                                 ` Randy Brukardt
2019-06-11  0:32                                   ` Optikos
2019-06-11 15:39                                     ` Brad Moore
2019-06-11 16:14                                       ` John Perry
2019-06-11 16:46                                         ` Shark8
2019-06-11 19:29                                           ` John Perry
2019-06-14  6:12                                             ` Brad Moore
2019-06-14 21:51                                               ` John Perry
2019-06-14 16:29                                             ` djakoogler
2019-06-11 18:19                                         ` joakimds
2019-06-11 15:49                                   ` Jeffrey R. Carter
2019-06-07  7:36                       ` Niklas Holsti
2019-06-05 22:41                     ` Randy Brukardt
2019-06-06  3:34             ` Keith Thompson
2019-06-06  7:29               ` Maciej Sobczak
2019-06-06 15:30                 ` John Perry
2019-06-06 15:41                 ` Brad Moore [this message]
2019-06-06 19:42                 ` Keith Thompson
2019-06-06 16:37               ` Dennis Lee Bieber
2019-06-02  9:59 ` joakimds
2019-06-02 20:14 ` G.B.
2019-06-03 13:37 ` John Perry
2019-06-03 14:50   ` Niklas Holsti
2019-06-03 19:23     ` John Perry
2019-06-03 21:04       ` Niklas Holsti
2019-06-03 18:51   ` Lucretia
2019-06-03 19:32     ` John Perry
2019-06-03 17:00 ` Jeffrey R. Carter
2019-06-03 18:59   ` Lucretia
2019-06-03 19:29   ` John Perry
2019-06-03 20:00     ` Jeffrey R. Carter
replies disabled

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