--
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 nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
Yes, it's more handy to have it synced (although, maybe it should be also allow to be used in async manner, for sake of completeness, but not sure about it).
> it's much better to be able to assume that a handler on nextTick() will be run after the full setup phase and that more required loading is will not happen after.Many times you cannot assume that. My app often loads a module when already up and running. When I am doing that I *really* hate blocking my entire app. Making that assumption kills a dynamic feature of the module system that the current api overlooks.
> Yeah, don't do that :)How else do you dynamically load a module?
The true question is, why doesn't node follow its own naming conventions, and call it requireSync()?
I know the answer is probably, because some code functions are older than these conventions. Anyway it makes a bad role model for module devs, if the core already takes it quite lenient.
I'd suggest a 2nd optional parameter, which can be a buffer or string what would be the files contents, even the filename is just a phony name to sure uniqueness and reuse. So if you need any kind if asynchronousness, database, web-fetch or whatever, its your responsibility to aquire the contents before calling require which by itself is always a requireSync.
Sync require makes it hard to do things like loading code dynamically or loading modules from a database
--
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 nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
ss.load.code()
that allows you to require modules in the browser in an asynchronous manner. (Of course that is different from an asynchronous require on the server)