Trans
9/11/2008 12:49:00 AM
On Sep 10, 2:59=A0pm, "DanDiebolt.exe" <dandieb...@yahoo.com> wrote:
> > ... each_with_index and each depend on each other
>
> =A0
> Maybe someone with more knowlege can track this dependance down. I am kee=
n to learn, but I have to admit that=A0I am stretching my understanding of =
the Ruby language here.
> =A0
> I would like to ask others if they think having each overloaded to take e=
ither |item| or |item,index| would be a general language improvement. Also,=
for greatest generality should this proposed redefinition of each be made =
to the class Array or to the enumerator mixin or somewhere else?
Can't do it, it would break things.
I've always though an special 'it' object would be nice though. Eg.
[:a, :b, c:].each do |e|
it.index
it.first?
it.last?
end
T.