from Hacker News

Handling errors in IcedCoffeeScript

by maxtaco on 9/18/14, 8:46 PM with 1 comments

  • by malgorithms on 9/18/14, 9:09 PM

    I think the great thing about IcedCoffeeScript + the ESC library is how it fits into more complicated flow logic, while allowing easy refactoring. Max doesn't really get into the otherwise impossible examples in his post.

    Even if you're firing off RPC's awaiting in the middle of a loop or switch statement, you can move logic around just by shifting individual lines. Consider how simple this looks:

       for user_id in user_ids
          await load_user user_id, esc defer user
          user.whatever()
          # etc., with user
    
    Writing that in plain Coffee or JS is impossible; using a pure async library is sort of possible but impossible to refactor.