Allow to use `(callback || throw)(error)`. #2909

alexeypetrushin opened this Issue Apr 5, 2013 · 4 comments


None yet

5 participants


Currently it's not compiled.

throws = (e) -> throw e
(cb or throws) error

Yep, it's a keyword.

@jashkenas jashkenas closed this Apr 5, 2013

I think the proposal is for a compilation such as this:

callback(error) || throw(error);

Like in LiveScript

(But that's a bit overkill.)


Please note that callable binary ops in LiveScript are unstable, meant for match (and doesn't apply to throw since it's a keyword).

(a || b) c => a(c) || b(c), which some people might find confusing. (you basically have to do [a || b]0 which is pretty bad; ((a || b)) doesn't work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment