How can it be sugar? It isn't compiled into anything else. Sugar is part of a syntax in a language.
You can call it whatever you want but it is a anonymous function being used as a callback and passed to a node function that is called many times. On Fri, Apr 27, 2012 at 8:57 PM, crypticswarm <[email protected]>wrote: > > > On Fri, Apr 27, 2012 at 10:40 PM, Mark Hahn <[email protected]> wrote: > >> > I would say that in node calling a callback more than once is not only >> discouraged, but forbidden, as if it were part of an implied, non written >> contract. >> >> Then how do you explain ... >> >> http.createServer(function (req, res) { > > > http.createServer(function (req, res) {}) > > is sugar for: > > http.createServer().on('request', function (req, res) {}) > > -- > 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 > -- 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
