On Wed, Jan 26, 2011 at 2:06 PM, khs4473 <khs4...@gmail.com> wrote: > - Whether the module identifiers should be specified in a variadic > list or an array:
A.) LOAD("a", "b", "c", function(...) { ... }); B.) LOAD(["a", "b", "c"], function(...) { ... });
Current show of hands. Please copy and update this block in responses.
A.) B.) Kris Kowal +1, Christoph Dorn +1
Christoph Dorn on B: "This seems cleaner and easier to scan and lends itself better to dynamic generation."
On Wed, Jan 26, 2011 at 2:55 PM, Kris Kowal <kris.ko...@cixar.com> wrote: > On Wed, Jan 26, 2011 at 2:06 PM, khs4473 <khs4...@gmail.com> wrote: >> - Whether the module identifiers should be specified in a variadic >> list or an array:
> A.) LOAD("a", "b", "c", function(...) { ... }); > B.) LOAD(["a", "b", "c"], function(...) { ... });
B.) +1 James Burke
Not adding the names, because I already started typing one message before another came in with someone else's response in another thread, so probably best to just indicate your preference and tabulate later.
On Wed, Jan 26, 2011 at 5:55 PM, khs4473 <khs4...@gmail.com> wrote: > A) > Reasoning: variadic list benefits newbies at minimal cost to advanced > users.
A.) Kevin H Smith B.) Kris Kowal, Christoph Dorn, Mikeal Rogers, James Burke
On Thu, Jan 27, 2011 at 10:24, Kris Kowal <kris.ko...@cixar.com> wrote: > +1 for single-module shorthand.
> A.) LOAD("a", "b", "c", function(...) { ... }); > B.) LOAD(["a", "b", "c"], function(...) { ... }); > C.) LOAD("a", function (a) { ... });
> Hands:
> A.) Kevin H Smith > B.) Kris Kowal, Christoph Dorn, Mikeal Rogers, James Burke > B+C.) Tom Robinson, Kris Kowal
> -- > You received this message because you are subscribed to the Google Groups > "CommonJS" group. > To post to this group, send email to commonjs@googlegroups.com. > To unsubscribe from this group, send email to > commonjs+unsubscribe@googlegroups.com<commonjs%2Bunsubscribe@googlegroups.c om> > . > For more options, visit this group at > http://groups.google.com/group/commonjs?hl=en.
A.) LOAD("a", "b", "c", function(...) { ... }); B.) LOAD(["a", "b", "c"], function(...) { ... }); C.) LOAD("a", function (a) { ... });
Hands:
A.) Kevin H Smith B.) Kris Kowal, Christoph Dorn, Mikeal Rogers, James Burke, John J Barton B+C.) Tom Robinson, Kris Kowal, Irakli Gozalishvili, Hannes Wallnoefer, Kevin H Smith
A.) LOAD("a", "b", "c", function(...) { ... }); B.) LOAD(["a", "b", "c"], function(...) { ... }); C.) LOAD("a", function (a) { ... });
Hands:
A.) Kevin H Smith B.) Kris Kowal, Christoph Dorn, Mikeal Rogers, James Burke, John J Barton B+C.) Tom Robinson, Kris Kowal, Irakli Gozalishvili, Hannes Wallnoefer, Kevin H Smith, Christoph Dorn
On Wed, Jan 26, 2011 at 11:18 PM, Tom Robinson <tlrobin...@gmail.com> wrote: > What about a third option: the first argument could be an array, or a string if you want to load a single module.
> C) LOAD(<String,Array> ids, function(...) { ... });
I prefer that the API args look similar to any module declaration, like the define/module.declare variants that allow specifying dependencies as an array. I like the mental model of "dependencies are always in an array", which allows for easier human reading of code, and gives the complete module API (definition and dynamic require) more consistency.
christoph...@christophdorn.com> wrote: > Going with B or B+C.
> Update:
> A.) LOAD("a", "b", "c", function(...) { ... }); > B.) LOAD(["a", "b", "c"], function(...) { ... }); > C.) LOAD("a", function (a) { ... });
> Hands:
> A.) Kevin H Smith > B.) Kris Kowal, Christoph Dorn, Mikeal Rogers, James Burke, John J Barton > B+C.) Tom Robinson, Kris Kowal, Irakli Gozalishvili, Hannes > Wallnoefer, Kevin H Smith, Christoph Dorn
> -- > You received this message because you are subscribed to the Google Groups > "CommonJS" group. > To post to this group, send email to commonjs@googlegroups.com. > To unsubscribe from this group, send email to > commonjs+unsubscribe@googlegroups.com<commonjs%2Bunsubscribe@googlegroups.c om> > . > For more options, visit this group at > http://groups.google.com/group/commonjs?hl=en.
> All 3 versions *could* be easily supported by just a couple lines of > code...
> function(modulesArray, callback) { > if (!Array.isArray(modulesArray)) { > callback = arguments[arguments.length-1]; > modulesArray = slice.call(arguments, 0, arguments.length-1); > } > // The rest of the module initialization... > }
> No?
> On Thu, Jan 27, 2011 at 9:27 AM, Christoph Dorn < > christoph...@christophdorn.com> wrote:
>> Going with B or B+C.
>> Update:
>> A.) LOAD("a", "b", "c", function(...) { ... }); >> B.) LOAD(["a", "b", "c"], function(...) { ... }); >> C.) LOAD("a", function (a) { ... });
>> Hands:
>> A.) Kevin H Smith >> B.) Kris Kowal, Christoph Dorn, Mikeal Rogers, James Burke, John J Barton >> B+C.) Tom Robinson, Kris Kowal, Irakli Gozalishvili, Hannes >> Wallnoefer, Kevin H Smith, Christoph Dorn
>> -- >> You received this message because you are subscribed to the Google Groups >> "CommonJS" group. >> To post to this group, send email to commonjs@googlegroups.com. >> To unsubscribe from this group, send email to >> commonjs+unsubscribe@googlegroups.com<commonjs%2Bunsubscribe@googlegroups.c om> >> . >> For more options, visit this group at >> http://groups.google.com/group/commonjs?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "CommonJS" group. > To post to this group, send email to commonjs@googlegroups.com. > To unsubscribe from this group, send email to > commonjs+unsubscribe@googlegroups.com<commonjs%2Bunsubscribe@googlegroups.c om> > . > For more options, visit this group at > http://groups.google.com/group/commonjs?hl=en.
> All 3 versions *could* be easily supported by just a couple lines of code...
> function(modulesArray, callback) {
> if (!Array.isArray(modulesArray)) {
> callback = arguments[arguments.length-1];
> modulesArray = slice.call(arguments, 0, arguments.length-1);
> }
> // The rest of the module initialization...
> }
> No?
> On Thu, Jan 27, 2011 at 9:27 AM, Christoph Dorn <
> christoph...@christophdorn.com> wrote:
> > Going with B or B+C.
> > Update:
> > A.) LOAD("a", "b", "c", function(...) { ... });
> > B.) LOAD(["a", "b", "c"], function(...) { ... });
> > C.) LOAD("a", function (a) { ... });
> > Hands:
> > A.) Kevin H Smith
> > B.) Kris Kowal, Christoph Dorn, Mikeal Rogers, James Burke, John J Barton
> > B+C.) Tom Robinson, Kris Kowal, Irakli Gozalishvili, Hannes
> > Wallnoefer, Kevin H Smith, Christoph Dorn
> > --
> > You received this message because you are subscribed to the Google Groups
> > "CommonJS" group.
> > To post to this group, send email to commonjs@googlegroups.com.
> > To unsubscribe from this group, send email to
> > commonjs+unsubscribe@googlegroups.com<commonjs%2Bunsubscr...@googlegroups.c om>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/commonjs?hl=en.