I'd like to address some concerns @Mark: no, there's no slowdown. Compilation is done only once in a lifetime of a function, results are cached. @Raynos: please note how elegant and readable the circuit solution is: it speaks for itself in 3 lines, and it does not have and "russian dolls" in it - plain code, much like sequential one; BUT it knows itself what is parallel and what is sequential. So, with almost no extra noise it supports parallelism, which is very important in server applications. "Nothing cleaner than being explicit"? I think circuit is as explicit as it gets.
about "disorder": yes, there are many libraries that are based on the raw idea of "reactive programming". The difference is: I tried to make CONCEPT out of this raw idea so that all details associated with NODEJS async programming I'm aware of fit into it nicely. Central point of control is important. Loops (over streams) are important. Debugging. Timeouts. Circuit KNOWS its structure (no other solution I'm aware of knows it), Based on this knowledge, you can build nice debugging tool that shows the graph , etc. Based on this knowledge, you can parallelize beyond one processor. I am not sure many people read the entire writeup, and I'm sorry I couldn't keep it shorter (really takes time to read), but I wanted to tell the entire story. Isn't it interesting that circuit.run() and circuit.loop() cover A LOT of real world use cases? Guys, let's discuss it, I think it can make nodejs programming more accessible, help to bring it more mainstream. I need your criticism really. Is there something that is missing from the picture? Something wrong? Of 2 versions of syntax, which is better? Is it really as "elegant" as I imagine? If not, what should be changed? Etc. I will appreciate any feedback Thanks, Alex On Saturday, December 29, 2012 3:16:39 AM UTC-5, Eldar wrote: > > @Raynos, @greelgorke I would recommend reading Out of the > tarpit<http://shaffner.us/cs/papers/tarpit.pdf>. > It argues that traditional imperative approach with control flow being > messed with logic leads to complex unmaintainable just ugly software. > > On Saturday, December 29, 2012 11:39:28 AM UTC+4, Raynos wrote: >> >> You can implement the same idea with two functions >> >> Here the code is explicit about how it runs code. >> >> ```js >> var execute = require("execute") >> , serial = require("serialize") // unimplemented see >> https://gist.github.com/4405173 >> >> var run = serial([ >> function (cb) { >> execute({ >> sum1: function (cb) { add(1, 2, cb) } >> , sum2: function (cb) { add(3, 4, cb) } >> }, cb) >> } >> , function (result, cb) { >> add(result.sum1, result.sum2, cb) >> } >> ]) >> >> run(printResult) >> >> function printResult(err, result) { >> if (err) { >> throw err >> } >> console.log("result", result) // prints "result=10" >> } >> ``` >> >> Although your idea is interesting, it's hard to build something that's >> cleaner then just being explicit about how you do things. >> >> Also notice that because we are using clean functional abstractions they >> compose trivially ( http://jsfiddle.net/fvz7N/4/ ) like functions should. >> >> Your ideas however are interesting, the problem is that they are far more >> complex to grok and require trust on self organizing code. Also it's full >> of implicit magic by the very definition of self organizing code. >> >> It should be noted substack had a similar idea with disorder ( >> https://github.com/substack/node-disorder#disorder ) >> > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
