• entries
359
237
• views
189653

Workday: Victory (mostly)

193 views

(see below for the problem in detail)

The bug has been squashed. The problem was in the loop element; during the upgrade of them to properly deal with yield-blocks I made a mistake in how the predicate is processed. It was doing:

while( predicate && I'm not supposed to yield control ){    do stuff();}

The problem was with the foreach loop, which reduces to while( itr.MoveNext()){...}. So when the loop element checked, it ran MoveNext before doing the yield check, causing the duplication behavior. A simple reversal of the conditions and the code below gives 01234 as it should.

I also fixed a bug where a yield at the end of a block caused the block to return rather than yield. Ended up being a problem during the restart; the 'end of statements' condition wasn't distinguishing between a restart there and reaching there due to simply running out of statements.

Tomorrow should be the matter of turning take(int, collection) into take int from collection

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

×