I think the Sync alternative functions in core should go entirely. They clutter APIs (and mentalities).
On Mon, Apr 2, 2012 at 10:53 AM, Oliver Leics <[email protected]> wrote: > Asynchronicity in Node can not be made optional as it is (by design) > the default. > > > On Mon, Apr 2, 2012 at 4:20 AM, Olivier Lalonde <[email protected]> wrote: >> I believe there would be an easy way to change the status quo without >> impacting developers who chose to adhere to a strict async style. The >> solution I propose is simply a pattern for writing I/O APIs: every I/O call >> should be async unless no call back is supplied, in which case the I/O call >> should be sync and use return / throw statements instead of calling a >> callback. > > Please, have a look at streamline.js > https://github.com/Sage/streamlinejs > > It kind of reveres your proposed solution by giving every async > function the same callback that turns the async function into a sync > function (aka: you can write code that looks synchronous) > > Short example: > > var s = fs.stat(path, _) > console.log(s.size) > > The underscore "_" is the callback you have to give to every async > function to turn it into a function that behaves like a synchronous > one. > > I would really like to know if that might work for you. > > -- > 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
