Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-24 Thread Paul Carvalho

On 23/01/07, Bret Pettichord wrote:


This is largely because Watir is stupid in this area. We made a bad
design choice with Watir 1.0. We'd now like to make Watir consistent and
start with 0 everywhere (like everything else in Ruby) but this would
raise compatibility issues. We welcome your thoughts in this area.



I think being consistent everywhere would be a good thing.  If that means
being consistent with Ruby and starting at 0, then so be it.

Personally, I think the person who first coded programming/scripting
languages to start counting at 0 should have had his/her head examined and
then been committed to an insane asylum.  I've learnt many programming
languages over the years and even once sat and painfully read through a
series of programming language manuals as long as a desk shelf back almost
20 years ago.  I still recall how that language was hailed as a
Fourth-Generation Language that was supposed to make programming easier
because the syntax and vocabulary (commands, methods, etc) were closer to
more natural language.  It seemed ironic that the easier the language was
supposed to be, the more manuals were required to teach you how to program
in it.

The point here is that it is natural for human beings to start counting at
1.  I have never in my entire life ever heard anyone start counting at 0.
*That* is stupid.

So, Paul, how many children do you have?  Well, my first boy would be 0,
and my second son would be 1, so I guess I have 1 child.  Even the Cat in
the Hat's best friends are Thing 1 and Thing 2.  I would have like to
have heard Dr. Seuss' thoughts on the topic of counting.

If machines can't be made to speak *our* language, then they're not very
useful.  Forcing people to think and code in that way is an impediment to
clear, human thought IMHO.

In the absence of something good, I'll take something consistent.  The
enemy you know and all that, right?  If you want to attract
non-programmers to the use of the tool, then you will have to appeal to them
in a friendly, non-programming way.  (That would include not forcing them to
rethink how to count because that's not a friendly thing to do.)

I recall Gracie Hopper once saying that if you hear the phrase that's the
way it's always been done then you know it's time to change it.

Well, you asked for my thoughts. ;-)  Thanks for asking.  Let me just put
this soapbox away for now.. ;-)

Cheers.  Paul C.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-24 Thread mi
Whoever you are, you are FREAKING FUNNY and made an excellent point 
here:-) 
 So, Paul, how many children do you have?  Well, my first boy would 
 be 0, and my second son would be 1, so I guess I have 1 child.  Even 
 the Cat in the Hat's best friends are Thing 1 and Thing 2.  I 
 would have like to have heard Dr. Seuss' thoughts on the topic of 
 counting.

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-24 Thread Bret Pettichord
Željko Filipin wrote:

 We'd now like to make Watir consistent and start with 0 everywhere
 (like everything else in Ruby) but this would raise compatibility
 issues. We welcome your thoughts in this area.


 I vote for start with 0 everywhere.
Here is where you and everyone with an opinion should vote: 
http://jira.openqa.org/browse/WTR-61

It would not be hard to change Watir, if we don't care about backwards 
compatibility. But if we do care, then this becomes a more difficult change.

Bret

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-24 Thread Paul Rogers
do we have the ability to vote 
'Yes - with no backwards compatability'
'Yes - with backwards compatability'
or 'No'

or just yes or no


Ive just grepped my code and found 196 occurrances of :index :-(


Paul



- Original Message -
From: Bret Pettichord [EMAIL PROTECTED]
Date: Wednesday, January 24, 2007 2:40 pm
Subject: Re: [Wtr-general] undefined method `[]' for nil:NilClass 
(NoMethodError) error at the end of array???

 Željko Filipin wrote:
 
  We'd now like to make Watir consistent and start with 0 
 everywhere (like everything else in Ruby) but this would 
 raise compatibility
  issues. We welcome your thoughts in this area.
 
 
  I vote for start with 0 everywhere.
 Here is where you and everyone with an opinion should vote: 
 http://jira.openqa.org/browse/WTR-61
 
 It would not be hard to change Watir, if we don't care about 
 backwards 
 compatibility. But if we do care, then this becomes a more 
 difficult change.
 
 Bret
 
 ___
 Wtr-general mailing list
 Wtr-general@rubyforge.org
 http://rubyforge.org/mailman/listinfo/wtr-general
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-24 Thread Bret Pettichord
Paul Rogers wrote:
 do we have the ability to vote 
 'Yes - with no backwards compatability'
 'Yes - with backwards compatability'
 or 'No'

 or just yes or no
   
I created two sub tickets. Vote for the one you want.

Without backwards compatibility
http://jira.openqa.org/browse/WTR-135

With backwards compatibility
http://jira.openqa.org/browse/WTR-134


But realize that if you vote for this ticket, that means that you don't 
want 0-based indexing in Watir ever unless it has backwards 
compatability. In other words, it is probably a no.

Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-23 Thread Chris McMahon
On 1/22/07, mi [EMAIL PROTECTED] wrote:
 t = [[a, b], [aa, bb]]

 0.upto (t.length) { |x|
 puts t[x][0]
 }

 For some reason i'm getting the following error at the end of the loop,
 any idea WHY???

0.upto (t.length-1) { |x|
 puts t[x][0]
 }

should do it, but I think you figured that out.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-23 Thread Paul Carvalho

This is one of those times when I'll never understand why some things in
programming start counting at 1 and some things start counting at 0.

I, too, have several similar loops in some of my scripts, but I opted for
the more readable format of saying:

t.length.times { |x|
   puts t[x][0]
}

I just can't be bothered with loops like 1.upto(t.length) {|x| puts x}
which, technically, counts from the first item to the last item, but
really x starts counting at 0 and goes to (length - 1).  This might be
convenient if you are working with arrays but not a whole lot else.

Paul C.



On 23/01/07, Chris McMahon [EMAIL PROTECTED] wrote:


On 1/22/07, mi [EMAIL PROTECTED] wrote:
 t = [[a, b], [aa, bb]]

 0.upto (t.length) { |x|
 puts t[x][0]
 }

 For some reason i'm getting the following error at the end of the loop,
 any idea WHY???

0.upto (t.length-1) { |x|
 puts t[x][0]
}

should do it, but I think you figured that out.

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-23 Thread Bret Pettichord
Paul Carvalho wrote:
 This is one of those times when I'll never understand why some things 
 in programming start counting at 1 and some things start counting at 0.
This is largely because Watir is stupid in this area. We made a bad 
design choice with Watir 1.0. We'd now like to make Watir consistent and 
start with 0 everywhere (like everything else in Ruby) but this would 
raise compatibility issues. We welcome your thoughts in this area.
 I, too, have several similar loops in some of my scripts, but I opted 
 for the more readable format of saying:

 t.length.times { |x|
 puts t[x][0]
 }
Another way to say this is:

  t.each {|x| puts x[0]}

Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-23 Thread Željko Filipin

On 1/24/07, Bret Pettichord [EMAIL PROTECTED] wrote:


We'd now like to make Watir consistent and start with 0 everywhere (like
everything else in Ruby) but this would raise compatibility issues. We
welcome your thoughts in this area.



I vote for start with 0 everywhere.
--
Zeljko Filipin
zeljkofilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] undefined method `[]' for nil:NilClass (NoMethodError) error at the end of array???

2007-01-22 Thread mi
sorry, i keep forgetting that the array starts at 0:-(

mi wrote:
 t = [[a, b], [aa, bb]]

 0.upto (t.length) { |x|
puts t[x][0]
 }

 For some reason i'm getting the following error at the end of the 
 loop, any idea WHY??? a
 aa
 undefined method `[]' for nil:NilClass (NoMethodError)

 Thanks in advance!

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general