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

Reply via email to