From: Simon Krahnke Date: 2008-04-26T08:35:04+09:00 Subject: goto (was: A couple of questions regarding class design) * Robert Klemme (08:32) schrieb: > On 21.04.2008 23:28, Michael W. Ryder wrote: >> I chose this after reading about it in Knuth's 2nd volume. I wanted >> to try to implement the binary greatest common divisor algorithm in >> Ruby. It took a little effort but I was able to implement it without >> any Go Tos. It is hard to go from languages that require jumping >> around in the code to one that doesn't. It's a totally different mind >> set. > > And, does it feel better? For me it does - for Knuth apparently not. I > haven't felt the need for a goto in ages. I also rarely use continue > and break in loops. My impression is that quite a number of cases where > either is chosen can be greatly improved and actually simplified by > choosing a different loop condition. My 0.02EUR... Tell that Matz & Co. ,----[ ruby-1.9$ grep -c goto *.c | grep -v 0 ] | array.c:2 | bignum.c:11 | class.c:4 | compile.c:18 | dir.c:5 | dln.c:32 | eval.c:3 | file.c:2 | gc.c:12 | io.c:15 | marshal.c:5 | numeric.c:1 | object.c:5 | pack.c:6 | proc.c:1 | process.c:2 | random.c:3 | range.c:2 | re.c:4 | regcomp.c:43 | regerror.c:1 | regexec.c:157 | regparse.c:94 | ruby.c:16 | signal.c:6 | sprintf.c:16 | string.c:8 | thread.c:3 | time.c:5 | util.c:92 | variable.c:3 `---- mfg, simon .... l