3 Aug 2010 3 Aug '10
On Mon, Aug 2, 2010 at 11:17 PM, Gregory Ewing email@example.com wrote:
Would you be interested in a system which requires marking calls to coroutines, but tells you immediately when you have forgotten to mark such a call?
It might work something like this:
- In a cofunction, a call to another cofunction must
be marked with 'cocall', e,g.
z = cocall f(x, y)
- Cofunctions *cannot* be called normally -- they do
not have a __call__ method, only a __cocall__ method.
So if you try to call a cofunction without using cocall, you get an exception. If you try to call an ordinary function using cocall, you get an exception. If you try to use cocall but forget to declare the function with codef, you get an exception (because cocall would only be allowed inside a cofunction).
I like this idea.