<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>doublerebel</author><text>&lt;i&gt;Mapping values in an object:&lt;/i&gt;&lt;p&gt;&lt;a href=&quot;http://coffeescript.org/#destructuring&quot; rel=&quot;nofollow&quot;&gt;http://coffeescript.org/#destructuring&lt;/a&gt;&lt;p&gt;&lt;i&gt;On backslashes:&lt;/i&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/jashkenas/coffee-script/issues/2457&quot; rel=&quot;nofollow&quot;&gt;https://github.com/jashkenas/coffee-script/issues/2457&lt;/a&gt;&lt;p&gt;Basically, if statements are that long, the code should be refactored.  This makes it easier to read and reduces the opportunity for bugs.  That pattern is one of the main reasons I like CoffeeScript.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b, c, d
        e()
&lt;/code&gt;&lt;/pre&gt;
Is clearly explained here:&lt;p&gt;&lt;a href=&quot;http://coffeescript.org/#switch&quot; rel=&quot;nofollow&quot;&gt;http://coffeescript.org/#switch&lt;/a&gt;</text><parent_chain><item><author>crazygringo</author><text>Just three completely undocumented syntax examples...&lt;p&gt;Mapping values in an object:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    {a, b} = c
&lt;/code&gt;&lt;/pre&gt;
Backslash to continue lines:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    a = long_variable_name \
      + other_long variable name
&lt;/code&gt;&lt;/pre&gt;
Switch statements without a parameter:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch
      when function_that_needs_to_return_true
        stuff
&lt;/code&gt;&lt;/pre&gt;
But the bigger problem is just having no idea how things will parse. For example, this works:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    a = b +
      c
&lt;/code&gt;&lt;/pre&gt;
But this doesn&apos;t:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    a = b
      + c
&lt;/code&gt;&lt;/pre&gt;
And then this works:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b, c, d
        e()
&lt;/code&gt;&lt;/pre&gt;
But this doesn&apos;t (a multi-line form you might want to use if the variable names were really long):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b, 
          c,
          d
        e()
&lt;/code&gt;&lt;/pre&gt;
And this doesn&apos;t:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b
      when c
      when d
        e()
&lt;/code&gt;&lt;/pre&gt;
After trial-and-error, you discover it has to be this, with a seemingly random backslashes:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b, \
          c, \
          d
        e()
&lt;/code&gt;&lt;/pre&gt;
I could go on and on -- but you get the point. The whole language is only discoverable via trial and error. None of this is documented. (Apologies for taking up so much vertical space of the comments!!)</text></item><item><author>lowboy</author><text>Pardon? The coffeescript site has pretty comprehensive info that describes the syntax. If you don&apos;t find a specific example on the site, &quot;it&apos;s just Javascript&quot; has rung true for me in almost every case.&lt;p&gt;Yes, there is a learning curve and it does things slightly differently. The implicit return value is just something you read once and then integrate. True, function hoisting is lost in cs, but that has never been a problem for me.</text></item><item><author>crazygringo</author><text>Where I work, we moved the project I work on to CoffeeScript about a year ago, and I&apos;ve been using it ever since.&lt;p&gt;Putting syntactic sugar aside, while some things are very welcome (list comprehensions, ===, ?), there are two main reasons why I would be wary of using CoffeeScript again:&lt;p&gt;1. Complete lack of documentation for syntax. Because there are basically no more braces and parentheses, CoffeeScript just tries to guess what you&apos;re doing, as far as I can tell, based on a bunch of internal heuristics. Unfortunately, there&apos;s no way for me to learn how to write parseable code without constantly pasting into the coffeescript.org site, and seeing if CoffeeScript understands it or not. This is the first language I&apos;ve ever used where the syntax rules are essentially unknowable, and a lot of time gets wasted trying to discover them through trial and error.&lt;p&gt;2. Unexpected side effects. For example, functions return the last evaluated value by default. If you&apos;re using $.each(), and your function&apos;s last line is something that returns false (like a separate function you call), then your $.each() loop will terminate unexpectedly early, since jQuery does that when it receives a false. So CoffeeScript isn&apos;t just a wrapper around JavaScript, but it really changes its behavior. Another example: CoffeeScript gets rid of function hoisting. A significant JavaScript feature, completely gone.&lt;p&gt;I personally am slower to code in CoffeeScript, because I know JavaScript 100% inside and out, but with CoffeeScript that isn&apos;t really possible, because so much of its implementation is undocumented. I mean, many times you&apos;re forced to end a line with a backslash in order to continue it, and even the existence of that necessary feature isn&apos;t mentioned once in the docs.&lt;p&gt;But a lot of people seem to love the syntax, and that seems to outweigh the negatives for them. I personally don&apos;t find JavaScript that ugly, but coding in a language I can&apos;t ever fully understand gives me a huge headache.</text></item></parent_chain></comment><story><title>Dropbox dives into CoffeeScript</title><url>https://tech.dropbox.com/?p=361</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>lowboy</author><text>1) Destructuring assignment: &lt;a href=&quot;http://coffeescript.org/#destructuring&quot; rel=&quot;nofollow&quot;&gt;http://coffeescript.org/#destructuring&lt;/a&gt;  (although they lack an object example).&lt;p&gt;2) This has to do with the unary plus operator more than just cs - since +varname is an expression, it treats it as such. Fair complaint - I&apos;ve never run into that. Also, this works just fine if you put the plus on the end of the first line:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    a = long_var_name + 
        hey_another_var
&lt;/code&gt;&lt;/pre&gt;
3) When would you use those?&lt;p&gt;4+5) Are cases of the unary operator in 2)&lt;p&gt;6-10) Sure, this is limiting if you want to write switch statements like that.&lt;p&gt;I feel that your coding style is different, or that you&apos;re listing edge cases to be contrarian. Coffeescript has a much smaller range of syntax deviations but that&apos;s part of what allows it to be so brief and clean.</text><parent_chain><item><author>crazygringo</author><text>Just three completely undocumented syntax examples...&lt;p&gt;Mapping values in an object:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    {a, b} = c
&lt;/code&gt;&lt;/pre&gt;
Backslash to continue lines:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    a = long_variable_name \
      + other_long variable name
&lt;/code&gt;&lt;/pre&gt;
Switch statements without a parameter:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch
      when function_that_needs_to_return_true
        stuff
&lt;/code&gt;&lt;/pre&gt;
But the bigger problem is just having no idea how things will parse. For example, this works:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    a = b +
      c
&lt;/code&gt;&lt;/pre&gt;
But this doesn&apos;t:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    a = b
      + c
&lt;/code&gt;&lt;/pre&gt;
And then this works:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b, c, d
        e()
&lt;/code&gt;&lt;/pre&gt;
But this doesn&apos;t (a multi-line form you might want to use if the variable names were really long):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b, 
          c,
          d
        e()
&lt;/code&gt;&lt;/pre&gt;
And this doesn&apos;t:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b
      when c
      when d
        e()
&lt;/code&gt;&lt;/pre&gt;
After trial-and-error, you discover it has to be this, with a seemingly random backslashes:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    switch a
      when b, \
          c, \
          d
        e()
&lt;/code&gt;&lt;/pre&gt;
I could go on and on -- but you get the point. The whole language is only discoverable via trial and error. None of this is documented. (Apologies for taking up so much vertical space of the comments!!)</text></item><item><author>lowboy</author><text>Pardon? The coffeescript site has pretty comprehensive info that describes the syntax. If you don&apos;t find a specific example on the site, &quot;it&apos;s just Javascript&quot; has rung true for me in almost every case.&lt;p&gt;Yes, there is a learning curve and it does things slightly differently. The implicit return value is just something you read once and then integrate. True, function hoisting is lost in cs, but that has never been a problem for me.</text></item><item><author>crazygringo</author><text>Where I work, we moved the project I work on to CoffeeScript about a year ago, and I&apos;ve been using it ever since.&lt;p&gt;Putting syntactic sugar aside, while some things are very welcome (list comprehensions, ===, ?), there are two main reasons why I would be wary of using CoffeeScript again:&lt;p&gt;1. Complete lack of documentation for syntax. Because there are basically no more braces and parentheses, CoffeeScript just tries to guess what you&apos;re doing, as far as I can tell, based on a bunch of internal heuristics. Unfortunately, there&apos;s no way for me to learn how to write parseable code without constantly pasting into the coffeescript.org site, and seeing if CoffeeScript understands it or not. This is the first language I&apos;ve ever used where the syntax rules are essentially unknowable, and a lot of time gets wasted trying to discover them through trial and error.&lt;p&gt;2. Unexpected side effects. For example, functions return the last evaluated value by default. If you&apos;re using $.each(), and your function&apos;s last line is something that returns false (like a separate function you call), then your $.each() loop will terminate unexpectedly early, since jQuery does that when it receives a false. So CoffeeScript isn&apos;t just a wrapper around JavaScript, but it really changes its behavior. Another example: CoffeeScript gets rid of function hoisting. A significant JavaScript feature, completely gone.&lt;p&gt;I personally am slower to code in CoffeeScript, because I know JavaScript 100% inside and out, but with CoffeeScript that isn&apos;t really possible, because so much of its implementation is undocumented. I mean, many times you&apos;re forced to end a line with a backslash in order to continue it, and even the existence of that necessary feature isn&apos;t mentioned once in the docs.&lt;p&gt;But a lot of people seem to love the syntax, and that seems to outweigh the negatives for them. I personally don&apos;t find JavaScript that ugly, but coding in a language I can&apos;t ever fully understand gives me a huge headache.</text></item></parent_chain></comment><story><title>Dropbox dives into CoffeeScript</title><url>https://tech.dropbox.com/?p=361</url></story>