Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!petrus!scherzo!allegra!mit-eddie!think!harvard!seismo!rochester!bullwinkle!uw-beaver!fluke!ssc-vax!savage From: savage@ssc-vax.UUCP (Lowell Savage) Newsgroups: net.lang Subject: Re: and if you put this in your languag Message-ID: <685@ssc-vax.UUCP> Date: Thu, 3-Apr-86 20:06:44 EST Article-I.D.: ssc-vax.685 Posted: Thu Apr 3 20:06:44 1986 Date-Received: Tue, 8-Apr-86 06:16:25 EST References: <1187@mmintl.UUCP> <6925@cca.UUCP> Organization: Boeing Aerospace Co., Seattle, WA Lines: 60 The discussion was "structured programming" and goto's in code. Richard Harter proposed a "new" type of programming language feature to take care of the case where goto's are most commonly used in HOL's. This case is (for those who have not been following the discussion or have forgotten by now), to use a goto statement to 'escape' from several levels of nested block and control structures. > ... I would like to have the following structures available: > > BLOCK label_name { > ..... > } > > LOOP label_name { > ..... > } > > FRAGMENT label_name { > ..... > } > > A FRAGMENT is essentially an internal procedure without arguments; > a BLOCK is a labelled block of code; and a LOOP is a labelled (forever) > loop. The command statement that I want is: > > escape [(block/loop)_label_name] [via fragment_name] > > This statement transfers control to the next statement after the > block (loop) but first executes the named fragment. If there is > no block/loop label name the escape leaves the current block/loop. > If there is no via clause control is transferred directly to the > next statement. Every once in a while I find that I would really > like to have something like this available. I beleve that Ada provides such a facility (with an "exit" statement which can take arguments that are block names) only without the FRAGMENT capability. If there is some set of code that needs to be executed before the block is exited, then that code can come before the exit statement. However, Ada also provides another mechanism which I think can be used for complete purpose intended by Richard. This is the exception mechanism. The FRAGMENT is now the statements after the exception handler, and the "exit" or "escape" statement is now the Ada "RAISE" statement which raises some exception known only within that block of code. > > Richard Harter, SMDS Inc. I am not associated with Ada in any way except as a former (and not very thorough) student of it. And as a potential user of it. Ada flames will not be appreciated if they only contain the SOT (Same Old Thing). Lowell Savage, Boeing Aerospace Co. Ada is a trademark of the Joint Ada Office of the DoD (I think). My opinions will reflect those of my employer, my SA, or other entities capable of "reflecting opinions" only if such entity pays me enough to agree to release my opinions for such "reflection".