------art_18667_18312398.1171063089799
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 2/9/07, Gary Wright <gwtmp01 / mac.com> wrote:
>
>
> On Feb 9, 2007, at 5:43 PM, Garance A Drosehn wrote:
> > There's a situation that I occassionally run into, which I can work
> > around easy enough, but it seems that there might be an cleaner
> > solution than the ones I fall back on.  Let's say I want to have
> > something like:
> >
> > ARGV.each { |arg|
> >    case arg
> >    when "-f"
> >        ...do something with the *next* value of |arg|...
> >    end
> > }
>
> Switch this to:
>
>    list  RGV.dup   # leave ARGV alone


   while item  ist.shift
>      case arg
>      when "-f"
>         file  ist.shift
>      end
>    end


Again, I am not looking for any ARGV-specific solution, or even a
solution which only works for arrays.  I run into the same situation
in other contexts than ARGV.  I see this as an issue which is bigger
than just the Array class.

And yes, I have been able to work around all of those situations by
creating various temp-variables or using other hacks, but I always
feel like I'm "working around" the problem, instead of coming up with
a nice clean pattern that solves it.  I have this vague feeling that
there "should" be some cleaner way to handle all these situations.

...even if I can't describe it very well!      :-)

-- 
Garance Alistair Drosehn                 drosihn / gmail.com
Senior Systems Programmer
Rensselaer Polytechnic Institute;             Troy, NY;  USA

------art_18667_18312398.1171063089799--