Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Autocb with multiple arguments #29

Open
andreyvit opened this Issue Mar 29, 2012 · 4 comments

Comments

Projects
None yet
5 participants

This gives an “unexpected ,” error message:

foo = (autocb) ->
  return null, 42

Node.js-style async callbacks often accept multiple arguments (error and result, at least), so I cannot use autocb with them currently.

Looks like one could start investigating this with nodes.coffee line 760 (a node for Return statement), although the parser will need to be fixed too.

Owner

maxtaco commented Mar 29, 2012

I think this is a good idea in theory. In practice, it's going to mean an even wider fork from CoffeeScript. Also, the autocb stuff has in my experience been the trickiest to get right and keep correct as CoffeeScript changes.

DallanQ commented Apr 10, 2012

While I too would like multiple autocb arguments, the most important thing for me about iced-coffee-script is that it stays up to date with coffee-script, especially as they consider adding things like line number mapping. Something that requires a wider fork from CoffeeScript is probably not worth it, in my opinion.

I'm with @DallanQ on this one. Let's keep your workload as low as possible, to keep this fork up-to-snuff as long as possible. It's already starting to quiet down, and that scares me; because it's an excellent project.

vjpr commented May 1, 2013

I would like this feature. In the meantime if the Node.js callbacks are coming from code you write, you can use destructuring assignment the following:

fn = (autocb) ->
  await foo, defer e, data
  return {e, data}

await fn, defer {e, data}
return e if e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment