That certainly matches my memories. I guess that is why the discussions to create the F77 standard looked more like mad dogs fighting than like academic style discussions
lewist57 wrote:My recollection is that prior to, and including F77, there were dozens of "dialects" of Fortran because folks just wanted to add features in their compilers that were not in the standard, resulting in difficulties in porting the program between various machines and compilers.
Feel free to ask! I fear that I will have to disappoint you: I haven't looked at this code since my student days, 40+ years ago. The detail justifications for how we did it is mostly forgotten long time ago. And, I never programmed Fortran professionally. We did a few projects at the university. Since then, Fortran has just been an entry in the 'competence list' in my CV (and today, that must be considered a lie).
lewist57 wrote:I do have a few questions for you, my apologies for asking; they involve subroutine SUBROUTINE:
1) I am not sure about the (re)declaration of the values in SUBROUTINE. The code assumes that variables are initialized to zero - I thought that was defined by the Fortran standard. We had denied ourselves the use of (numeric) constants. If you want to honor this requirement, you may e.g. zero INTEGER by adding as the first statement "INTEGER = INTEGER - INTEGER".
2) I am sorry - I can't explain this one. If the compilers we used did allow such redefinition (the non-array arguments are never used), it would be an excellent way of confusing the code reader. Maybe that is why we did it that way. I don't remember.
3) The two arguments are the logical unit number, IF (= 1) being console output. The second argument is a format string. The first WRITE loop is the one indenting the line properly, which apparently is not valid in F77, as both our F77 compilers failed to do proper indentation. Maybe the format string could be updated to F77 standard; it just specifies two space characters to be output. The format is that of the FORMAT statement which requires the format string to be enclosed in parentheses, so the '(' and ')' are just to fulfill this requirement. It seems like the '$' is a quoting, to prevent the tokenizer from stripping away the space.
For the second WRITE loop, it seems to me that the format string could have been written '(I4)'; I have no recollection of why the '$' is there.
I have a vague memory of FUNCTION being there for a purpose, the program not working without it. I may be wrong - maybe we put it in there just to confuse people to believe that it had a purpose
I really appreciate that you spend time trying to make this program work! Unfortunately, I am too far away from you to give you - in the hand, in the meat world - the 🍺 I told I would give to the first one telling what the output of this program is, but you seem to be one who is likely to win the prize. If you decide to spend a vacation in Norway, I'll gladly buy you one!
And then ... Have you noticed my entries in the thread 'General Programming | Algorithms | Aide pour un programme langage c'? Through a lengthy discussion, in particular with jschell, I argue in favor of a programming language being defined in terms of a parser tree, with no (reserved or just predefined) keywords. An IDE working directly on a parse tree would represent structural information in binary format, making it visible to the user by e.g. typographic highlighting, but requiring the user to create structure by function keys or menu selections, rather than by keywords. Just like a document processor - it has no (reserved) keywords that you cannot use freely in your document, and there is nothing you can put into the text body that will confuse the binary structure information.
lewist57 wrote:Overall, this is an excellent program to torture new users of Fortran to drive home the point that even though you could use keywords as variables, you really should not.
I really wish we could have a language defined by its abstract syntax rather than by textual keywords. But I am not holding my breath waiting for it to appear.