coffee-script icon indicating copy to clipboard operation
coffee-script copied to clipboard

Autocb with multiple arguments

Open andreyvit opened this issue 13 years ago • 4 comments

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.

andreyvit avatar Mar 29 '12 11:03 andreyvit

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.

maxtaco avatar Mar 29 '12 13:03 maxtaco

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.

DallanQ avatar Apr 10 '12 19:04 DallanQ

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.

ELLIOTTCABLE avatar Mar 22 '13 05:03 ELLIOTTCABLE

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

vjpr avatar May 01 '13 05:05 vjpr