Closed virtuald closed 9 years ago
Now that is a great idea! I had been wrestling for a while on how to better do that.
Implemented the concept in 71dda4450a8e55852ea976bb31aa91c530ea7af4. Not using generators, exactly, but an object passed to the function that has an "active" value, which will turn false upon event termination.
Referring to the hello world module (https://github.com/Team4819/4819-2014-Offseason-RobotPy/blob/master/modules/examples/hello_world_module.py):
Perhaps instead of requiring an 'inverse callback', just provide a generator to anything that you call, and have the generator return False when the code needs to exit the function. There are a lot of asynchronous frameworks in python that do a similar thing already (like tornado).