🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Tangent: Yield, part 3

Published January 26, 2009
Advertisement
Lots of time tonight to work on Tangent and get yield working. Lots of trying to follow spaghetti stack in a debugger to see where and how yield methods don't work. My brain hurts...

I have yield working in source, sort of. If you try and yield from inside a nested block, and then re-call the method, and there's local variables used in the sub-block from a higher scope (but only if used after the yield statement)... then it breaks at runtime. I know vaguely where the bug is, but am at the moment incapable of tracking state as the various yield blocks go on and off of the stack.


Example code for the night:

public yields<string> Cow(){	yield("moo.");	yield("moo!");	yield("MOO!");}public static void main(){	foreach(string word in Cow()){		print word;                // moo.moo!MOO!	}}


If you change the 2nd yield to a return(); you only get moo.

Tidbits of progress.
0 likes 1 comments

Comments

Jotaf
Don't worry, I'm sure it will yield good results in due time [grin]
January 27, 2009 10:36 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement