Live data from Hacker News

Ada is not just another programming language (1986)

sci-hub.se

21–30 of 68 posts

Re: Ada is not just another programming language (1986)

#21

Ada is just another programming language.

True, but nevertheless Ada is an important language in the history of programming languages. After 1970, there were less and less innovations in programming languages, in the sense of features that have not existed in any earlier languages. Many new languages have been introduced since then and some of them might be better than most previous languages, but usually the new languages offer only new combinations of feat…

How verbose is it compared to others like Go or Rust ?

Re: Ada is not just another programming language (1986)

#22

Earlier quoted context omitted.

Pascal had subrange types before Ada, not only for integers but characters too. var day : 1 .. 31; letter : 'A' .. 'Z'; And you could specify ranges on array subscripts as well: var weight : array[-5 .. 5] of integer;

Wirth removed this again in Oberon, because experience with Pascal and Modula showed that it is not worth it.

That's very interesting. Subranges is a feature that I have always liked in Pascal and other languages.

You do have any more detail about the reasoning why Wirth thought this feature was "not worth it" for Oberon? Were programmers not using this feature in Pascal and Modula-2? Did Wirth consider it more noise or complexity in those languages?

Re: Ada is not just another programming language (1986)

#23

Earlier quoted context omitted.

True, but nevertheless Ada is an important language in the history of programming languages. After 1970, there were less and less innovations in programming languages, in the sense of features that have not existed in any earlier languages. Many new languages have been introduced since then and some of them might be better than most previous languages, but usually the new languages offer only new combinations of feat…

How verbose is it compared to others like Go or Rust ?

Somewhat more verbose.

A great part of the verbosity is due to the fact that unlike CPL/BCPL/B/C and the languages inspired by them, which have replaced the Algol statement parentheses begin and end with "{" and "}" or similar symbols, Ada uses relatively long words as statement parentheses, e.g. loop and end loop.

On the other hand, a good feature of Ada is that it followed Algol 68 in having different kinds of statement parentheses for different program structures, so you do not need to spend any time in wondering whether a closing "}" matches the one opened by a "for" or by an "if", many lines above.

Re: Ada is not just another programming language (1986)

#24

Ada is just another programming language.

True, but nevertheless Ada is an important language in the history of programming languages. After 1970, there were less and less innovations in programming languages, in the sense of features that have not existed in any earlier languages. Many new languages have been introduced since then and some of them might be better than most previous languages, but usually the new languages offer only new combinations of feat…

>Some of those features have been introduced only recently in more popular languages, while others are still missing from most languages.

Can you give an example of an ADA feature missing from most languages? I know ADA is supposed to be good for writing reliable software, are there any important features related to that which other languages could adopt?

Re: Ada is not just another programming language (1986)

#25

Earlier quoted context omitted.

Wirth removed this again in Oberon, because experience with Pascal and Modula showed that it is not worth it.

That's very interesting. Subranges is a feature that I have always liked in Pascal and other languages. You do have any more detail about the reasoning why Wirth thought this feature was "not worth it" for Oberon? Were programmers not using this feature in Pascal and Modula-2? Did Wirth consider it more noise or complexity in those languages?

[deleted]

Re: Ada is not just another programming language (1986)

#26

Earlier quoted context omitted.

How verbose is it compared to others like Go or Rust ?

Somewhat more verbose. A great part of the verbosity is due to the fact that unlike CPL/BCPL/B/C and the languages inspired by them, which have replaced the Algol statement parentheses begin and end with "{" and "}" or similar symbols, Ada uses relatively long words as statement parentheses, e.g. loop and end loop . On the other hand, a good feature of Ada is that it followed Algol 68 in having different kinds of sta…

Honestly, I don't get why people care so much about typing loop and end loop etc in their code. But after using nim where I can just ignore the default style and write everything in snake_case (which brings me joy as I find camelCase harder to read and annoyingly ugly), I think more language should be style agnostic (with tools for converting between styles for others' reading benefit). Ada could support curlies AND verbal curlies allowing people who don't think that there is any benefit in loop/end loop to just use {}.

Re: Ada is not just another programming language (1986)

#27

Earlier quoted context omitted.

Wirth removed this again in Oberon, because experience with Pascal and Modula showed that it is not worth it.

That's very interesting. Subranges is a feature that I have always liked in Pascal and other languages. You do have any more detail about the reasoning why Wirth thought this feature was "not worth it" for Oberon? Were programmers not using this feature in Pascal and Modula-2? Did Wirth consider it more noise or complexity in those languages?

Found this paper "From Modula to Oberon" by Wirth himself

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.578...

"Subrange types were introduced in Pascal (and adopted in Modula) for two reasons: (1) to indicate that a variable accepts a limited range of values of the base type and to allow a compiler to generate appropriate guards for assignments, and (2) to allow a compiler to allocate the minimal storage space needed to store values of the indicated subrange. This appeared desirable in connection with packed records. Very few implementations have taken advantage of this space saving facility, because the additional compiler complexity is very considerable. Reason 1 alone, however, did not appear to provide sufficient justification to retain the subrange facility in Oberon."

"... was the observation that in a growing number of programs the indiscriminate use of enumerations (and subranges) had led to a type explosion that contributed not to program clarity but rather to verbosity."

Instead the proposed solution is to use SET.

"With the absence of enumeration and subrange types, the general possibility of defining set types based on given element types appeared as redundant. Instead, a single, basic type SET is introduced, whose values are sets of integers from 0 to an implementation-defined maximum."

Re: Ada is not just another programming language (1986)

#28

Earlier quoted context omitted.

True, but nevertheless Ada is an important language in the history of programming languages. After 1970, there were less and less innovations in programming languages, in the sense of features that have not existed in any earlier languages. Many new languages have been introduced since then and some of them might be better than most previous languages, but usually the new languages offer only new combinations of feat…

>Some of those features have been introduced only recently in more popular languages, while others are still missing from most languages. Can you give an example of an ADA feature missing from most languages? I know ADA is supposed to be good for writing reliable software, are there any important features related to that which other languages could adopt?

A feature that for a long time was missing from most languages, but which has been adopted by many during the last decade, is to accept separator characters in numbers, to improve the readability of long numerical constants.

Ada introduced this in 1979, by allowing "_" in numbers. Cobol, in 1960, allowed hyphens in identifiers, for better readability. Because hyphens can be confused with minus, IBM PL/I, in 1964, replaced hyphen with low line, which remains in use until today in most programming languages. Ada extended the usage from identifiers to numbers. Most languages have followed Ada and also use "_" for this purpose, except C++ 2014, which based on a rationale that I consider to be extremely wrong, has substituted the low line with single quote.

While this is an example of an Ada feature that could be easily adopted in any other language, other features are more difficult to adopt without important changes in the language, so they did not spread much.

An example is the specification of the procedure/function parameters as being of 3 kinds, in, out and inout.

This feature was not invented by the Ada team, but by one of the authors of the DoD IRONMAN language specifications, maybe by David Fisher, but the DoD documents do not credit any authors.

In the predecessor of Algol, IAL 1958, the procedure parameters had to be specified as in or out. However this feature was dropped in ALGOL 60. Nevertheless, there was a programming language, JOVIAL, which, unlike most programming languages, was derived directly from IAL 1958, and not from the later version, ALGOL 60.

So JOVIAL inherited the specification of parameters as in or out. JOVIAL happened to be used in many DoD projects, and because of this it influenced the initial versions of the DoD requirements, which eventually resulted in Ada.

The first DoD requirements included the specification of in and out parameters, but in the beginning the authors did not have a good understanding about how the parameter specification should be used, so the DoD requirements had a bad wording, implying that this specification is meant to determine whether the parameters shall be passed by value or by reference.

After several revisions of the DoD requirements, in 1977, the IRONMAN requirements were issued, which were very much improved. By the time when IRONMAN was written, the authors had realized that whether the parameters are passed by value or by reference is an implementation detail that must be decided by the compiler and which must be transparent for the programmer.

Moreover, they realized that 3 categories must be specified, i.e. out and inout must be distinct, because the semantic is very different and the compiler must do different actions to implement them correctly.

Many current programming languages are much more complicated than necessary because they lack this 3-way distinction of parameters.

The language most affected by this is C++, which has struggled for 30 years, from 1980 until 2011, until it has succeeded to include in the language the so called "move semantics", to avoid redundant constructions and destructions of temporaries. Even if now the extra temporaries may be avoided, this requires a contorted syntax.

All such problems could have been trivially avoided since the beginning, if C++ had taken from Ada the "out" and "inout" specifications. During the transition from C with Classes to C++, in 1982-1984, C++ was nonetheless strongly influenced by Ada in the introducing of overloaded functions, overloaded operators and generic functions (templates).

While C++ has introduced the reference parameters, to avoid to write large quantities of "&" and "*", like in C, it would have been much better to apply the Ada method, where it is completely transparent whether the parameters are passed by value or by reference and the programmers never have to deal with "&", unless they use explicit pointers and pointer arithmetic, wherever pointers are really needed for their extra features, not for telling the compiler how to do its job.

This purpose is as obsolete as the use of the keyword "register" for telling the compiler where to allocate variables. Even the C/C++ compilers ignore the fact that the programmer writes that an input parameter shall be passed by value and they pass it by reference anyway if the parameter is too large. This should have been the rule for any kind of parameters.

Re: Ada is not just another programming language (1986)

#29
post #27

Earlier quoted context omitted.

That's very interesting. Subranges is a feature that I have always liked in Pascal and other languages. You do have any more detail about the reasoning why Wirth thought this feature was "not worth it" for Oberon? Were programmers not using this feature in Pascal and Modula-2? Did Wirth consider it more noise or complexity in those languages?

Found this paper "From Modula to Oberon" by Wirth himself http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.578... "Subrange types were introduced in Pascal (and adopted in Modula) for two reasons: (1) to indicate that a variable accepts a limited range of values of the base type and to allow a compiler to generate appropriate guards for assignments, and (2) to allow a compiler to allocate the minimal storage…

Thank you :-)

It seems subranges could be something of a double-edged sword. Too many enumerations and subranges in a program adds complexity. However, without them I presume the guards need to be coded manually elsewhere in the program.

It's really fascinating to see the reasoning a programming language designer makes when choosing what feature to include - or exclude.

Re: Ada is not just another programming language (1986)

#30
post #3

Ada is a language that has been on my "todo list" of languages for awhile (just after FORTH). I generally hate this term, but Ada does kind of look like a language that was "ahead of its time", specifically in regards to concurrency.

While studying how concurrency is done in Ada is certainly instructive and even today many languages and multi-threading libraries have more poor support for concurrent programming than Ada had since the beginning, a language that was really ahead of its time regarding concurrency was IBM PL/I.

15 years before Ada, in 1964, IBM PL/I had facilities for multitasking that e.g. included a wait function that could do everything that can be done with WaitForMultipleObjects / WaitForSingleObject. The POSIX threads suck because they lack such a powerful wait function and many other multi-threading libraries, e.g. the C++ standard library, are forced to offer only what is available everywhere, so they do not have anything that is missing in the POSIX threads.

Post reply on HN