Coroutines are an indeed fine concept. Though, since their execution order is not transparent, you have to assume that they are non-deterministic. This leads to akward code and side effects when you attempt to snychronize e.g. several entity actions. Plus, freezing code which is intersected with wait(1) statements leads to a A) proprietary compilation which is B) not optimized (it is a safe bet that the compiled game runs way faster if you use the VS compiler because it does a hell of optimizations) and C) slower due to the fact of freezing code (storing and restoring local variables, instruction pointers, parameters, etc.pp) and D) single threaded (atm and I wouldn't bet on it that JCL ever makes the execution of all concurrent coroutines multi-threaded!).

If you use the event-hook so that the engine calls one callback function each frame you can do a semantic thread of execution by yourself which avoids all these problems. It forces you to think about your coding (opening coroutines by random just because you have wait(1) is evil, it looks easy and tempting, just because it is easy - but in the end you are yelling around just because refactoring your code is painful. This applies to most novices.). And it gives you the opportunity to do better coding. Things like polymorphism comes into play, which is great (others too, I am just mentioning this one).

and...

var is a fixed point type - which is, technically speaking, a pain in the ass. It is limited, it is unprecise, it is inconvenient. Working with var's feels sometimes like arguing with a woman.

Last edited by HeelX; 08/01/10 09:19.