[#7055] More on VC++ 2005 — Austin Ziegler <halostatue@...>

Okay. I've got Ruby compiling. I'm attempting to get everything in

17 messages 2006/01/05
[#7058] Re: More on VC++ 2005 — nobuyoshi nakada <nobuyoshi.nakada@...> 2006/01/06

Hi,

[#7084] mathn: ugly warnings — hadmut@... (Hadmut Danisch)

Hi,

22 messages 2006/01/10
[#7097] Re: mathn: ugly warnings — Daniel Berger <Daniel.Berger@...> 2006/01/10

Hadmut Danisch wrote:

[#7098] Design contracts and refactoring (was Re: mathn: ugly warnings) — mathew <meta@...> 2006/01/10

Daniel Berger wrote:

[#7118] Re: Design contracts and refactoring (was Re: mathn: ugly warnings) — mathew <meta@...> 2006/01/12

*Dean Wampler *<deanwampler gmail.com> writes:

[#7226] Fwd: Re: Question about massive API changes — "Sean E. Russell" <ser@...>

Hello,

23 messages 2006/01/28
[#7228] Re: Question about massive API changes — Caleb Tennis <caleb@...> 2006/01/28

>

[ ruby-Bugs-3175 ] enum.find with ifnone calls ifnone process even if find succeeds

From: noreply@...
Date: 2006-01-04 03:00:18 UTC
List: ruby-core #7051
Bugs item #3175, was opened at 2006-01-03 19:49
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=3175&group_id=426

Category: Core
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Phil Duby (pduby)
Assigned to: Nobody (None)
Summary: enum.find with ifnone calls ifnone process even if find succeeds

Initial Comment:
This is using ruby 1.8.2 (2004-12-25) [i386-mswin32] on windows XP pro

Calling the find method on an Array including the optional (ifnone) block parameter cause the ifnone block to always be executed, even if the find
succeeds.  In fact, from my testing, it is called before the first call to the regular find block.  The documenation (rdoc) says the ifnone block should only be called if the find block does not match any object.

From the inheritance, I assume the problem in in enum, not in the Array class.

Below is the output from the small ruby program I attached to demonstrate the error.  The 999 and following array values are dummy entries I had the ifnone and find blocks add, to verify the sequence of calls.

> ruby -v -w bug_find_with_ifnone.rb
ruby 1.8.2 (2004-12-25) [i386-mswin32]
Initial powers array = [2]
start more_powers( 15, 2)
end more_powers( 15, 999) = 16
Adjusted powers array = [2, 4, 8, 16, 999]
Found next power after 15 = 16
Using find without an ifnone clause
Found next power after 7 = 8
Unchanged powers array = [2, 4, 8, 16, 999]
Same find that does not reach the end of the array, but with
an ifnone clause that will update the array if called
start more_powers( 28, 999)
end more_powers( 28, 999) = 999
Changed powers array = [2, 4, 8, 16, 999, 999, 2, 4, 8]
Found next power after 7 = 8


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=3175&group_id=426

In This Thread

Prev Next