I can't decide if it's a +1 or -1 yet..But here's what I have to say

I tend to like 0-based, since it's something that's taught to you as a
programmer.  So when I first worked with tables and thought
table[0][0] would give me the first cell (which errored out..it kinda
threw me off a bit).  On one hand it makes sense (table wise) to start
indexing at row 1 and column 1, on the other hand it's like a 2D array
which should have the same indexing as any other array, starting at 0.

I guess having it 0-based will prevent any other incompatibilities
such as the .times do|x| as above.  Having said that, my
indecisiveness is now leaning more towards +1...although it might mean
some script changes to reflect my table *for loops* starting at index
1 :)

Shao




On 8/19/05, Jonathan Kohl <[EMAIL PROTECTED]> wrote:
> Consistent 0-based counting is my preference.
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Bret
> > Pettichord
> > Sent: August 19, 2005 1:07 PM
> > To: [email protected]
> > Subject: RE: [Wtr-general] finding text in a cell that
> > containsaspecified image?
> >
> > Should i read this as +1 for changing to 0-based indexing in
> > watir? For both (:index, n) as well as table indexing?
> >
> > At 01:37 PM 8/19/2005, Jonathan Kohl wrote:
> > >I prefer 0-based counting, but I don't have a bunch of tests I'm
> > >relying on that use indexes like others might.
> > >
> > >For me, I find it hard to explain 0-based counting in data
> > structures
> > >like arrays to beginners, and then have to change gears and
> > tell them
> > >that when they use an index, that it is 1-based. There are pros and
> > >cons to both, but I think when programming in terms of 0-based.
> > >Actually, programming has completely ruined my mental model
> > for 1-based
> > >counting in general. :)
> > >
> > >This is probably something beginners have less of a problem with at
> > >first than people with programming backgrounds, but the
> > inconsistency
> > >is what I think feels wrong.
> > >
> > >-Jonathan
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED] On Behalf Of Bret
> > > > Pettichord
> > > > Sent: August 19, 2005 12:27 PM
> > > > To: [email protected]
> > > > Subject: Re: [Wtr-general] finding text in a cell that contains
> > > > aspecified image?
> > > >
> > > > At 12:47 PM 8/19/2005, Shao Kang Tat wrote:
> > > > >So I'm assuming Watir will always start at index 0 when using
> > > > >.times
> > > > >do|x|is that right?  Would it be possible to make watir Know what
> > > > >iscalling .times so that it can start at a different index - in
> > > > >thiscase, tables?  I actually do use .times do|x| in
> > some cases but
> > > > >Inever tried with tables until now because I assumed it
> > > > would start atindex 0.
> > > > >Shao
> > > >
> > > > Ruby always starts at index 0.
> > > >
> > > > We made a big mistake in designing Watir and used one-based
> > > > indexing. The problems you are running into are
> > consequences of our
> > > > design error.
> > > >
> > > > For example,
> > > >
> > > >    ie.table(:name, 'foo')[2][3].text
> > > >
> > > > is the same as
> > > >
> > > >    ie.table(:name, 'foo').to_a[1][2]
> > > >
> > > > This is because the first is 'watir' and the second is
> > 'ruby', but
> > > > we realize that everyday users will never be likely to
> > figure this
> > > > out.
> > > >
> > > > We've discussed changing Watir to use zero-based
> > indexing, but are
> > > > concerned about compatability. Paul discussed this in a recent
> > > > email.
> > > > Comments? Anyone opposed to a switch?
> > > >
> > > > Bret
> > > >
> > > >
> > > >
> > > > _____________________
> > > >   Bret Pettichord
> > > >   www.pettichord.com
> > > >
> > > > _______________________________________________
> > > > Wtr-general mailing list
> > > > [email protected]
> > > > http://rubyforge.org/mailman/listinfo/wtr-general
> > > >
> > >
> > >_______________________________________________
> > >Wtr-general mailing list
> > >[email protected]
> > >http://rubyforge.org/mailman/listinfo/wtr-general
> >
> > _____________________
> >   Bret Pettichord
> >   www.pettichord.com
> >
> > _______________________________________________
> > Wtr-general mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
> 
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to