Hacker News new | past | comments | ask | show | jobs | submit login

This `for` loop looks particularly curious to me:

  for (int i = this.bindings.Count - 1; i >= 0; i = Math.Min(this.bindings.Count - 1, i - 1))
Why isn't the last expression a normal i--?



Because bindings[10] might have triggered a process that removes bindings 7-9, causing "i" to be out of bounds of the array. I wanted to continue updating the remaining bindings even if some of them got removed.


Wow, that's pretty subtle. Thanks for explaining.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: