top | item 44052081

(no title)

kevlar700 | 9 months ago

True but it was far more open than a committee. The STRAWMAN requirements were circulated widely for comment to industry, military, federal and academic communities and to select experts such as Dijkstra and Hoare. Then WOODENMAN circulated for comment after incorporating changes based on STRAWMANS responses.

discuss

order

adrian_b|9 months ago

I wish I knew who were the anonymous authors of DoD "IRONMAN" (January 1977), especially who has written the paragraph "7.2.F. (7F.) FORMAL PARAMETER CLASSES".

"IRONMAN" has introduced a very important innovation in programming languages, which has been inherited by Ada and by its derivatives, e.g. VHDL (the innovation is that formal parameters may have 3 kinds of behaviors, "in", "out" and "in out", and that the parameter behavior must be specified, but not its implementation mechanism, like in older programming languages).

Unfortunately this innovation has remained largely unknown for the authors of most more recent programming languages, which are defective because of that.

If Bjarne Stroustrup had bothered to read carefully the Ada specification before conceiving "C with Classes", he might have understood the implication of the "IRONMAN" parameter classes for languages with constructors and destructors, like C++, which could have avoided many decades of pain for the C++ users. In a language with the "IRONMAN" parameter classes, constructors can be ordinary functions and there is no need for many features that complicate C++, like distinct copy constructors and assignment operators, or "move" semantics. Moreover, the performance problems that have plagued C++ before 2011, due to the creation of unnecessary temporaries, would have been avoided since the beginning.

It is likely that the authors of "IRONMAN" did not fully understand the consequences of their innovation, but they had proposed it only in order to make the new DoD language more similar to Jovial, which was a programming language used in several DoD projects at that time. Jovial had such formal parameter classes, but their meaning was slightly different than in "IRONMAN" and in the later Ada, enough to make them much less useful.

Before "IRONMAN", the earlier DoD requirements were to be able to specify whether the parameters are passed by value or by reference, which is an extremely wrong requirement. It is the same mistake made by C and by its derivatives, including recent derivatives, like Rust.

How the parameters are passed must be decided by the compiler, not by the programmer. For the programmer it does not matter whether a parameter is passed by value or by reference, when the passing of the parameters is implemented correctly (e.g. an in-out parameter that is passed by value is copied from the caller to the function and then back when the function returns, if that is necessary; frequently this is not necessary, e.g. if the parameter is located in a register; if the in-out parameter is so big that copying would be slow, the compiler decides to pass it by reference; in C and its derivatives, both out and in-out parameters must be passed by reference, even when that is the wrong choice; moreover, the compiler cannot flag as an error the reading of an out parameter prior to its first writing).

touisteur|9 months ago

Yes this is one of my favorite Ada features (combined with named paramètres at call-site) it always felt clearer reading or writing Ada. The intent ('what') is more important (to me, reading heaps and heaps of code) than the 'how' that I can infer quickly and is less useful in data-flow reading mode.

renox|9 months ago

> the innovation is that formal parameters may have 3 kinds of behaviors, "in", "out" and "in out", and that the parameter behavior must be specified, but not its implementation mechanism, like in older programming languages

Great on paper, not so good in real life: so what is the specification when a parameter is aliased? That is to say passed two times to a procedure: once as an "in" parameter, the other as an "in out" parameter. I've been able to use compiler explorer to show the behaviour may change depending on the size of the parameter with GNAT, ( https://news.ycombinator.com/item?id=43001394 ).

mafribe|9 months ago

> How the parameters are passed must be decided by the compiler, not by the programmer.

Consider the program

   def f(x):
      return 17
If omega is a non-terminating expression then the call

  f(omega)
might or might not terminate, depending whether the compiler uses a lazy or eager evaluation strategy. This freedom is not something I would recommend to a programming language designer.