From: Ryan Pavlik Date: 2004-02-08T04:54:22+09:00 Subject: Re: [RFC] 'via' proposal On Sun, 8 Feb 2004 04:37:28 +0900 Elias Athanasopoulos wrote: > Hello! > > Well, just a thought... Consider that: > > 1000.times do |a, b, c| > a = ... > b = ... > c = ... > bar a > bar b > bar c > foo > end > > Okay, this is a bad design, but let's say that I can't change > it. I'm not sure what's "bad design" about it... there's not really enough to tell what you're actually doing. If you want fewer lines, you can always: 1000.times { |a, b, c| a = bar(...) b = bar(...) c = bar(...) foo } Fewer lines or more lines isn't directly related to how good or bad a design is though. > Can a Ruby syntax structure like the one below constructed > in an (almost) easy way? > > via bar foo do |a, b, c| > a = ... > b = ... > c = ... > end > If all these do not make sense, just forgive me. It's night > here. :-) I really can't tell what you're trying to do here... please provide more details about the actual problem at hand: what you're doing, what you're trying to accomplish in the end (not just how you're trying to accomplish it). My guess is there's an easier way. To answer your question, though, you can always write a function that takes a block as a parameter. However, you can't directly manipulate the code inside; otoh, I'm guessing you don't really need to. -- Ryan Pavlik "As in the case of CLAMZILLA..." - 8BT