Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Argument starter - The roots of all evil
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00938079
Message ID:
00940129
Vues:
28
>>SNIP
>>>
>>>John,
>>>
>>>First of all, I don't consider myself an "expert". Rather I simply believe that if there's a reason that is quantifiable for breaking "the rules", then by all means do so.
>>>
>>>OTOH, I think that, in most cases, following the rules demonstrates a long term benefit.
>>>
>>>The thing is, in order to follow the rules and to know when to break them requires that the rules, and their purpose, are understood in the first place.
>>
>>George,
>>
>>Where is this "rule" that says EXIT/LOOP are WRONG?
>>EXIT/LOOP, for instance, do NOT qualify for the "single exit point" rule because they are not exiting the module but simply exiting (or redoing) some looping construct.
>>
>Jim,
>
>IMV, they're the xBase equivalent of GOTO. That's me. I've never found a reason to use them.

George,

OK, that's your view.
But for other readers of the thread I want to clarify something...

EXIT/LOOP are in no way the equivalent of a GOTO, specifically in the way that structured programming specified the elimination of GOTO. In fact you'll find that EXIT/LOOP were added to languages to permit them to comply with structured programming specifications with simplification of code in the process.
Structured programming prohibits GOing (JUMPing, BRANCHing, etc) from one 'module' to another EXPLICITLY, which is what GOTO and its derivatives (can) do (making for fine spaghetti but most difficult code reading/debugging).
EXIT/LOOP, on the other hand, provide the ability to skip some code WITHIN a looping construct, EXIT going immediately to the next line after the looping construct and LOOP letting you resume the loop immmediately without executing code below itself. NOTE: Neither LOOP nor EXIT have any argument or parameter or operand so they can ONLY GO TO ONE DESTINATION EACH and THAT DESTINATION IS ALWAYS within the same module. Of course GO TO, JUMP, BRANCH etc ALL have to have an argument or parameter or operand (where to go) and such specification CAN GO ANYWHERE - within the same module or to another module.

cheers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform