In article <401C0A45.3000504 / hypermetrics.com>, Hal Fulton <hal9000 / hypermetrics.com> wrote: >Phil Tomson wrote: >>>That's why I personally would like to see it gone, and good riddance. >>>You, of course, are welcome to root for a pardon, but I just wanted to >>>make sure the other side of the aisle was represented :-) >>> >> And just what would you replace that functionality with? > >Phil, > >I'm with Nathaniel. Save the functionality but please KILL the >syntax. Only a perler could love it. (No offense meant.) Not everything in Perl was bad (No offense taken). Matz obviously got a lot of inspiration from Perl. It's a good thing, actually, because these sorts of things attract a lot of Perl people looking for something better. They find some familiar things to make them feel at home and some different things to make it seem worthwhile to switch. Given that Perl has the most users, this can be a good thing for Ruby to gain more users. The flip/flop operator is a powerful piece of syntax. Just because something isn't well understood doesn't mean we should just get rid of it, it probably means it needs to be documented better for those who aren't familiar with Perl. To those of us who came from Perl (and I suspect that's a lot of us) it seems pretty natural and so far I have yet to see any good way of replacing it. The attitude I'm hearing is that since some peole don't understand it, even those who do shouldn't get to use it which certainly doesn't see fair to those who gain a lot of benefit from it. Certainly I can agree, for example, that the $* vars need some synonyms in English (and I think most of them already have them), but I also think they should still be available for legacy sake. > >I haven't thought this through yet. But let's do it with a >method call. > > #untested > f.set_context(/BEGIN/,/END/) > f.each_line do |l| > if f.in_context > # do something with l... > else > # whatever > end > end > > >Comments, Phil? Nathaniel? Others? The same question remains: is it nestable? Would I be able to do: #untested f.set_context(/BEGIN/,/END/) f.each_line do |l| if f.in_context # do something with l... f.set_context(/def/,/end/) if f.in_context #do something between def and end inside of BEGIN END block end else # whatever end end It doesn't seem like it. If not, then we've lost a lot of functionality. Also, I would suggest that whatever new mechanism is introduced that there still be a way to use the old one, even if it means something like: require "pre2.0" #... if line=~/BEGIN/ .. line=~/END/ #... ....problem is that in this case we're talking about some syntax being deprecated and you can't get that back with a require in this case AFAIK. Phil