From: Donal K. F. <don...@ma...> - 2012-03-28 12:15:32
|
On 28/03/2012 09:50, Lars Hellström wrote: > The main problem is that "lightweight and simple" applies to the C side, > whereas the interface presented on the Tcl side is a sharp knife without any > handle: common things such as accessing a coroutine variable are very hard > to do completely right, and failures are typically catastrophic (your > coroutine dies). Conversely, just about the only thing that would be really > easy to do with the proposed [coinject] command is composition of functions > (in the strict mathematical sense), and that has nothing to do with coroutines! I think the key to that is what happens when an error is thrown inside an injected script. If that results in the error bubbling out to the injector but the coroutine not being destroyed, that'll be safe. (It does mean that some things can't be done by injection — e.g., injecting a [break] usefully — but I'll survive without them. AIUI, the main goal of injection is to support introspection and debugging, yes?) But I think that's [coeval] I've just described. Looking #383, that's *much* more "exciting". (I think you could use it with [yieldto] — and quite a lot more code besides — to build a [coeval], but I fail to see why we should offer an interface that's difficult to use when we can do something much simpler for programmers.) Donal. |