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

Closed
alexeypetrushin opened this Issue Apr 5, 2013 · 4 comments

Projects

None yet

5 participants

@alexeypetrushin

Currently it's not compiled.

@michaelficarra
Collaborator
throws = (e) -> throw e
(cb or throws) error
@jashkenas
Owner

Yep, it's a keyword.

@jashkenas jashkenas closed this Apr 5, 2013
@goto-bus-stop

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

callback(error) || throw(error);

Like in LiveScript

(But that's a bit overkill.)

@vendethiel
Collaborator

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