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