|
On 2/28/07, Dunfee, Randy <rdunfee@xxxxxxxxxxxxx> wrote:
I would prefer that the LEAVE opcode had never been added. IMHO, it is EVEN WORSE than a GOTO because the destination is implicit.
People have deeply felt (and not necessarily rational) feelings on this subject. All I have to say about LEAVE (and ITER) today is what I had to say about GOTO twenty years ago; if I ever need it I will use it, but I have never needed it.
I believe that when I see a conditioned DOU loop or a DOW loop that I have the right to expect that the ONLY way out of this loop is to meet the stated condition, and I can therefore skip desk-checking the "loop" code if that particular condition is not of interest to me. Is that REALLY too much to ask?
Straight from the Gospel according to Dijkstra (Go To Stament Considered Harmful) (http://www.acm.org/classics/oct95/). If the code is to be self-documenting, then all of the Do arguments need to be 'invariant' (i.e. the loop *can not* be exited until the stated conditions are meant). While it is possible to write non-spaghetti (structured) code with LEAVE/ITER/GOTO, it is very easy to fall into bad habits. But the people who use GOTOs (and its 'structured' bastard cousins) can be very defensive; claiming it is a bad practice is a good way to start an argument. Bottom line is, if the code works, it works. I, personally, find code with GOTO/LEAVE/ITERs hard to maintain, and really wish free-form RPG did not support LEAVE/ITER (similarly to the way it doesn't support GOTO).. Chris P.S. This discussion reminds me of my freshman programming class in college (rough 1979); Dr. Perlman (our instructor) said "If you use a GOTO, I will break your fingers, and then I will fail you." -- chris@xxxxxxxxx | Nothing is true; All is permitted www.pando.org | Hasan i Sabbah
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.