On Sat, Oct 29, 2011 at 8:10 AM, Greg Ewing email@example.com wrote:
Nick Coghlan wrote:
I think having such a construct will help qualm many of the fears people had about the original version of the implicit invocation proposal - just as try/except blocks help manage exceptions and explicit locks help manage thread preemption, being able to force ordinary call semantics for a suite would allow people to effectively manage implicit coroutine suspension in cases where they felt it mattered.
Maybe, but I'm still not convinced that simply factoring out the critical section into a 'def' function isn't sufficient to achieve the same ends of auditability and protection from unexpected changes in library semantics.
Also, elsewhere you're arguing that the ideal situation would be for there to be no distinction at all between normal code and coroutine code, and any piece of code would be able to carry out a coroutine suspension. Would you still want a critical section construct in such a world, and if so, how exactly would it work?
It would trigger a runtime error if any of the called functions attempted to suspend the coroutine.