From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucio De Re To: 9fans@cse.psu.edu Subject: Re: [9fans] Sam question Message-ID: <20010819131308.R6233@cackle.proxima.alt.za> References: <20010819085726.Q6233@cackle.proxima.alt.za> <034701c1289d$4b8be380$3cf7c6d4@SOMA> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <034701c1289d$4b8be380$3cf7c6d4@SOMA>; from Boyd Roberts on Sun, Aug 19, 2001 at 12:54:18PM +0200 Date: Sun, 19 Aug 2001 13:13:08 +0200 Topicbox-Message-UUID: e298b76e-eac9-11e9-9e20-41e7f4b1d025 On Sun, Aug 19, 2001 at 12:54:18PM +0200, Boyd Roberts wrote: > > well it's a toolkit. sometimes you have to use 'goto' for clarity, > much as i am loathed to. usually a: > I believe "goto" was retained in C for the benefit of code generators. The alternative to "goto" in your instance is actually (almost) obvious from your explanation ;-) You need the duplicate test to check a condition that will not change with changed circumstances, for example a variable set earlier or a function. The redundancy is unavoidable, at the end of a search you still need to know if you succeeded or failed: while (!finished && !found) { } if (finished) { } else { // found! } Sorry to teach you to suck eggs, I'm sure I'm not telling you anything new :-) On the other hand, I'd love a language where the above can be represented elegantly (for some value of elegantly, and SNOBOL doesn't count :-) ++L PS: Try/Catch in C++ addresses this out-of-band behaviour, Tcl uses "uplevel" and all round it does cry out for a clean solution. But I think it is quite intractable in linear languages and the human intellect balks at coding in two dimensions (or is it two-dimensional what we do and three- dimensional would be too hard?).