Hi, I'm curious about a patter that occurs at multiple places in the core node library.
In the http module (and other places), there are both exported constructors and exported factory functions for the same objects (e.g. http.Server() and http.createServer()). In many cases, the factory functions are just wrappers around the constructor. For example, the code for http.createServer in v0.8.23 is simply: exports.createServer = function(requestListener) { > return new Server(requestListener); > }; Can anyone explain why both are exported? Since createServer exists, I assume it's preferable to use that (perhaps for future-proofing one's code)? I'd also be interested to read any thoughts about when factory functions are preferable to constructors in the JS world. Thanks, -- Joel -- -- 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.