News for hackers. Stuff that matters.
Re:Dropbox dives into CoffeeScript by crazygringo on Thursday September 13, 2012 @10:12PM (#4519669)
What are you talking about? My particular use case that led to all this was just translating a simple, clean, elegant JavaScript switch like the following. It's ideal, really, in terms of readability:

    switch (operation_code) {
    case SUGGEST_ACTION:
       ...
       break;
    case PERFORM_ACTION_PREAUTHORIZE:
    case PERFORM_ACTION_AUTHORIZE:
    case PERFORM_ACTION_POSTAUTHORIZE:
       ...
       break;
    case DELETE_ACTION_REVERSIBLE:
    case DELETE_ACTION_IRREVERSIBLE:
    case DELETE_ACTION_NOT_PREAUTHORIZED:
    case DELETE_ACTION_PREAUTHORIZED:
       ...
       break;
    case UNDO_ACTION:
       ...
       break;
    (5 more groups of 30 more constants...)
    }
It's not variable names that push an 80 character limit. It's about translating groups of shorter constants, that taken together go over 80 lines, and which have similar prefixes, so they look very nice listed vertically, and make it very clear where their differences and similarities are.

I stand by my point: telling people that, in CoffeeScript, it's proper to "refactor" this into a switch statement with no parameter and creating entire new functions, is bizarre.

Re:Dropbox dives into CoffeeScript by jashkenas on Friday September 14, 2012 @12:28AM (#4520074)
Hey, that's a really good use case for multi-line cases. Not exactly the fallthrough behavior of the JavaScript example you posted ... but a good reason to want linebreaks in your list of values to match. You should open a ticket suggesting a syntax improvement for it.