From: "Berger, Daniel" Date: 2005-05-13T05:54:23+09:00 Subject: Re: [ ruby-Patches-1900 ] Pointless argc check in Array#select > -----Original Message----- > From: dblack@wobblini [mailto:dblack@wobblini] On Behalf Of > David A. Black > Sent: Thursday, May 12, 2005 1:55 PM > To: ruby-core@ruby-lang.org > Subject: Re: [ ruby-Patches-1900 ] Pointless argc check in > Array#select > > > On Fri, 13 May 2005, David A. Black wrote: > > > Hi -- > > > > On Fri, 13 May 2005, Daniel Berger wrote: > >> > >> Ah, here's the issue. > >> > >> # test.rb > >> a = [1,2,3] > >> a.select # LocalJumpError > >> > >> [].select # no error > >> > >> I'd call that a bug. I guess I better get crackin' with that test > >> suite, > >> eh? > > > > Just to throw in the counter-argument: > > > > Since the block would never be executed with an empty array anyway, > > why enforce its presence? > > Or, to put it more precisely: > > It's 'yield' that raises the exception. In this case: > > [].select > > yield is never called. So expecting an exception would be > sort of like expecting a ZeroDivisionError here: > > def z > return > puts 1/0 > end > z > > I now officially think that it is not a bug :-) Ok, I can accept that. :) Dan