A normal function just runs naturally through its code -- it can't abort/suspend/pause/defer evaluation. (Only the JVM or kernel can suspend things for you safely.) The inversion of control macros enable such capabilities for Clojure code while preserving normal semantics. It allows code to *yield* a thread to other code when a blocking channel operation is encountered [>! <! alt!]. Now the specific *mechanism* that core.async uses internally to acheive this happens to be a state machine with callbacks, but that's implementation detail.
IOC just means letting something else control the evaluation of the function's code. There is an example of another simpler IOC controller in the core.async tests, called 'runner'. Others are possible... preserving semantics is the key. (ioc [Ordinary code can be written many ways, like in a haiku]) => [[Ordinary code] [can be written many ways] [like in a haiku]] On Monday, August 19, 2013 6:42:01 AM UTC-4, Michal Till wrote: > > I kinda understand the whole problem and I also understand that this has > nothing to do with the OO IOC pattern, but I still don't exactly get what > is meant by this term. What is inverting what and where? What does > "control" refer to exactly - compared to callbacks? > > M. > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.