From: Rudolf Polzer Date: 2003-08-08T02:06:32+09:00 Subject: Re: Why does Ruby have callcc? Scripsit ille aut illa �Yukihiro Matsumoto� : > In message "Re: Why does Ruby have callcc?" > on 03/08/07, Mauricio Fern�ndez writes: > > |How consistent is this w/ your "no featuritis" policy? In LL2 you had > |to explain why Ruby had callcc but no macros; your answer was that the > |latter are more easily abused ("too powerful" IIRC). > > There's strong reason not to have macros in Ruby, as I believe. > Continuation does not harm you very much. Naq gurl'er gur bayl jnl gb trg bhg bs fbzr rivy pbafgehpgf... see my other posting. > |Do you still believe that or does "I provide the features, you use them" > |represent a new policy? > > I provide the features (which I choose), you use them. And I wouldn't say featurities... continuations are ONE feature which is a superset of coroutines, generators, setjmp/longjmp and the infamous goto. And they're hard enough to use to prevent BASIC-like GOTO spaghetti code. - coroutines and generators are obviously NOT contained in the rest of Ruby. - goto is a subset of setjmp/jongjmp and therefore not in Ruby (or is it?) Well, you all know that goto can be done using case, well, at least something similar: def goto(n) $newlineno = n end def stop() $newlineno = nil end $lineno = 0 while $lineno do $newlineno = $lineno + 1 case $lineno when 100; puts "Hello World" when 110; $i = 0 when 120; if $i > 10 then goto 160 end when 130; puts "Current $i: %d" % [$i] when 140; $i = $i + 1 when 150; goto 120 when 160; puts "Done!" when 170; stop end $lineno = $newlineno end But that's no real goto, it's just case misuse. And possible even in case-less languages like Perl using hashes or if... BTW: I know it hurts to read such code. Be happy I didn't add "COME FROM". -- PLEASE DO NOT GIVE UP