I'm trying to eliminate remaining boilerplate in circuit callback syntax. I
don't really like expression
this.setter.sum1. Tried to use "out" instead of "setter" (this.out.sum1) -
shorter, but not necessarily better.
Now I have another idea which may look stupid, but any idea is either old or
stupid or some combination of those
:)
How do you like this: writing (this.sum1) in parentheses instead of
this.setter.sum1
var circuit=new Circuit({
function() { add(1, 2, (this.sum1)) },
function() { add(3, 4, (this.sum2)) },
function() { add(this.sum1, this.sum2, (this.result)) }
})
There's interesting implementation trick: output tokens still can be
distinguished by parsing
(due to those parentheses);
Now, whenever token is known to be an output token of the gate, system
MODIFIES token variable behind the scenes, turning it into function
dynamically, before executing gate.
What is interesting about it is: program analyzes its own code, and makes
changes to environment dynamically to make
this code execute correctly. Isn't it an exciting idea? :)
--
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