j3-fortran / fortran_proposals

Proposals for the Fortran Standard Committee
175 stars 14 forks source link

GOTO statement explanation missing in https://fortran-lang.org #315

Open Liebenfiels opened 9 months ago

Liebenfiels commented 9 months ago

Hi I am learning Fortran based on Fortran 77 Programming 1990 Oxford book by Ellis and IBM Fortran compiler from 1984. I am following the website and see significant changes and lack of explanation of basics like GOTO label I have just learnt in 2023 BASIC-2 under GEM Locomotive 1986 first on my 1986 Amstrad (8 MHz, 512 kb, 5.25” 360 kb floppies) as it is key to understand past. The GOTO is very well explained in Locomotive manuals from 1986 and books from that era including Borland Turbo BASIC. Can you make a list please of all functions and Fortran reserved words (in upper case) and explain that GOTO, that is Python and others limitation since does not have GOTO (foundation of Fortran and BASIC). Also why so many changes that ruin the language, the key is stability the foundation it was made and not change it to unrecognised language -

I only rely on old manuals and books for now, below 1990 and reject all modern books.

Also when I type on website small letter print why it does not change it to capital PRINT, that was fundamental feature for user to type lower case and program to automatically change to upper case if typed correctly to pick up errors and see it better the functions within code and colour change is not a replacement. The website does not do it hence it has a bug in software. Must be changed to upper case, the very basic principle of language like BASIC or Fortran. Thank you Michal

FortranFan commented 9 months ago

I am learning Fortran based on Fortran 77 Programming 1990 Oxford book by Ellis and IBM Fortran compiler from 1984. I am following the website and see significant changes and lack of explanation of basics like GOTO label

You will have better luck trying to invent the time machine!

Or, you may want to start with "FORTRAN 77 for Engineers and Scientists by Larry Nyhoff and Sanford Leestma" and if you can try to be open-minded, move on to the book on Fortran 90 by the same authors and on to newer books. https://pubs.aip.org/aapt/ajp/article-abstract/61/4/383/1039958/Fortran-90-Explained-and-FORTRAN-77-for-Engineers?redirectedFrom=fulltext

certik commented 9 months ago

@Liebenfiels I liked Turbo Pascal from Borland more from that era. Do you recommend we provide tutorials how to use punch cards efficiently? I tried it in a museum, it was fun to use! I enjoyed it. I think most people prefer more modern editors though. It's probably similar with goto. It's fun to use, but I prefer not to use it in modern codes.

Liebenfiels commented 9 months ago

You cannot change the language too much, as you cannot change promissory contract note, if you write contract 30 years ago need to be valid today. The same was with Bitcoin code when developers removed nLocktime (many op codes as they did not know what is for)- big mistake if you already locked it, but protocol was restored with scripting capabilities as in original code from 2009. When Bitcoin was launched Nakamoto said "protocol is set in stone for lifetime"- but developers always have the intrinsic need to change something without comprehending outcome, remove etc when he left. He had to come back to put things in order. Whole point is not to change foundation. If someone has GOTO in code from 80s and validated code, then it is extra work to change it and validate again- and it is not the same clean branch structrure anymore.

Fortran was created by many experts upon many consultation from best math and computer scientists at time- there were good reasons behind each function put and even how is typed. Code written in 80s need to be easily transferable to modern compilers. I will have new colour monitor next year that will allow me to go black and white, I cannot use black and white if there are colours only and not capital PRINT and for other functions.

GOTO is very good function if it is not misused, but does not mean is should not exist because people fail to use it correctly. In early days they used GOTO line not even to label, that was error.

Voyager 1 &2 launched in ’77 are still communicating and are controlled from Earth with code language that need to be compatibly- backward and forward. NASA was in fact hiring people yearsback with Assembly and Fortran experience. Apollo missions were tested with Fortran and stability was key, hence moon landing was possible, now technology is lost together with bastardised languages with removed features.

If I code in script giving people option in menu 1,2,3 then GOTO direct it to appropriate module to execute code as good way to branch at that point as 1 module and 1 task. Any change I need to do to module 1 does not affect module 2 & 3 My BASIC script done in 1986 software on Amstrad (8 MHz) already beats AI (farm of CPUs) in 2023 on math as they don’t put validation loop, as they don’t have easy GOTO option to direct into logic gate self-validating code loop. It is not the machine it is person behind keyboard

I am not a programmer but Biologist and my code written in 1986 Locomotive BASIC-2 on single 5.25” 360 kb floppy beats modern AI, and I have to tell programmers to put logic gates and not assume it will work, this is what they taught in that old books as I learn. Code written on software from 80s should be copy paste to modern era with no changes or minimal, you cannot have GOTO does not work or FRAC function in 86 BASIC does not work now. You have compatibility of word document early to late versions and I use ChiWrirter 3.15 from 88 and works the same as 4.0- and it still better and faster on '86 Amstrad than any modern Microsoft word version.

Thank you the other book I will read, I am reading now Fortran 77 Programming (1990 Oxford) and I think Visual BASIC has GOTO under Microsoft Visual code in 2023 need to check, but I like to learn Fortran.

Liebenfiels commented 9 months ago

What I see nowadays with young generation they lack basic old school knowledge from books. They just learn from internet not books.

I have book 1986 on “Amstrad Simple BASIC2 Programs”, covers games, art, math even simple word processor and excel is there under code. Children at that time were able to grab code from magazines and type into program that come with computer (3rd Amstrad disk). I cannot now replicate easily the same code in Visual Studio- which is absurd. You cannot change English language and decide to remove words like GO TO and wipe out it from old books trying to replace with something new.

Liebenfiels commented 9 months ago

Have you by chance attempted to find and consult any experts that made Fortran or at least that work on it on 70s & 80s?- that would be beneficial to do to see what removal of features will do. Adding new one as long as it does not affect anything else, you have to forsee the potential problems like those messing with Bitcoin code have not realised what affect it will have breaching set in stone contracts. Thank you for your work on Fortran and answears

Liebenfiels commented 9 months ago

My Recommendations for Fortran to work • Re-instate all the functionality the Fortran language had (from beginning) to be both forward and backward compatible, while retaining added features. Incuding single standard for formulas, if there was change the new compiler need to recognise both versions. • Stability and predictability is key with functionality to be retained for any language- current implementation is not Fortran it is something else passing off (legal term of art in law) as Fortran that nobody will use because of changes. • Single standard for compilers with option under settings to enable typing the old format lower case changed to upper case and retain current format with lowe case too. Include in future AI translator from old type to new writing style and vice verra • **Fortran as language will only work if code written in book in 70 or 80 can be re-typed and run without failure in moder compiler. Otherwise, nobody will trust that code you write now in 2023, will be readable in 2033, the same way you cannot execute old codes in 2023 without adapting them. Nobody will invest time to redo work every 10 years. • The compilers from 80s or modern must produce the same output result (good way to self-validate, hence I use old systems too)

Any change can have serious consequence imagine If user locks now Bitcoin with nLock time (there is an app in sCript language) the script will need to be executed on the specified block in time that could 10 or 20 years or 50 years from now, otherwise contract will fail. e.g. hypothetically if to assume ON block x GOTO execute transaction to send money to new address does not work because someone decide to deactivate GOTO or equivalent in future it will be useless language- “hence protocol set in stone for lifetime” or network does not recognise the language anymore. You cannot re-write the contracts, there won't be any adoption.

Then Fortran will go back to old Glory and it will be used as stable Foundation with promise not to change, remove functionality. People still can be advised not to use certain options, but you cannot disable them as language will fall apart.

FortranFan commented 9 months ago

My Recommendations for Fortran to work

I disagree with almost everything you write but wish you well in influencing others, especially the standard-bearers of Fortran with your recommendations. May you truly have far better success than I with mine!!!

Liebenfiels commented 9 months ago

Currently the BASIC language has changed less. In reality the code written in 1964 as on page 10 (manuals are in that below link) must be executable in modern system, otherwise is a failure. GO TO was there in 1964 BASIC and is there in 2023 in Microsoft Visual studio (FRAC to show fractional part I dont see) is free to download and advance software. The Locomotive GEM in 1986 still allows you to type/add numbering in front although is not required anymore, but they knew to retain that historic functionality over 20 years later, adding things like FRAC formula to show fractional part is OK. Integer or square root in '86 Locomotive BASIC was written exactly the same INT or SQR as in 1964- nothing has changed as they followed set in stone rules. https://www.dartmouth.edu/basicfifty/basic.html

The Fortran 77 book helps me with BASIC to understand many things (loops etc), but I will learn Fortran only if know it will not deviate from original language, otherwise is waste of my time to learn something from book that is not valid anymore as it will never get adopted again because of changes.