azulus/cromulent — pull request #3 by azulus (2012-07-07 05:36:25+00:00)
Title: Starting to try out different ideas w/ variants

Still a work in progress, but thought I'd get thoughts on this. What do you think of lib/server.js and its usage of variants? Right now it's just creating a bunch of nodes in the graph for each potential output flag and requiring a context and forced map as input. A couple of thoughts:

1) the syntax for using these variants in the graph is long (see test/variants.js):
scope.createGraph('variant_flag-always_fails')
.give('variant_flag_context-always_fails')
.give('variant_flag_forced-always_fails')

2) they always require the context and forced fields... is there a way to make composers declare a field as optional? maybe use a ? or something in the name? (defineNode().outputs('fullName').given('firstName', 'middleName?', 'lastName'))

3) I'm also binding the forced fields based on the output flag, not based on the list of variants in the system, but I wasn't sure how that should be resolved... maybe this is fine. Input is much appreciated.