Live data from Hacker News

CoffeeScript's Time is Waning For Me

mattgreer.org

11–20 of 67 posts

Re: CoffeeScript's Time is Waning For Me

#11
post #2

"As my project grows in size, significant whitespace becomes more and more of a problem. It’s just plain not readable or visually parsable. Your files become a wall of dense text. Damn you Python, damn you to hell!" I would appreciate an explanation of this paragraph. How exactly does project size compound issues with significant whitespace? Are you indenting five levels or something?

I'd really like further explanation, too. If you're not properly indenting code in large projects — whatever the programming language is — I'd really hate working with you.

Re: CoffeeScript's Time is Waning For Me

#13
post #4
post #2

"As my project grows in size, significant whitespace becomes more and more of a problem. It’s just plain not readable or visually parsable. Your files become a wall of dense text. Damn you Python, damn you to hell!" I would appreciate an explanation of this paragraph. How exactly does project size compound issues with significant whitespace? Are you indenting five levels or something?

I would agree that the indentation in CoffeeScript causes confusion, especially since the recommended size is 2 spaces.

I don't think indentation is a problem particularly. Once you're familiar with languages that use it, e.g. Python, it gets pretty natural. I did run into problems with the 2 space indentation, however, because with certain character combinations, it's difficult without a second look to be sure.

I would argue there are bigger problems with CoffeeScript, such as empty blocks being legal. For example:

    if foo
    bar()
Is totally legal. But 99% of the time, you really mean:

    if foo
        bar()
In Python, the former is a syntax error and there is an explicit pass call to demonstrate that the block is empty. But in coffeescript, it's easy to accidentally write that code and it looks right when you're doing a quick read through. Again, I think 4 spaces would help as you would be expecting a larger indentation.

Re: CoffeeScript's Time is Waning For Me

#14
I have similar issues with coffescript, specifically the pain of significant whitespace is noticable whenever I find myself recalling how to write a simple `setTimeout` (or any similarly structured function) calls correctly, which is pretty much every time I use one as I don't find it particularly natural or intuitive.

Personally, though I'm looking at Dart rather than ES6.

Re: CoffeeScript's Time is Waning For Me

#15
post #3

> If you’re contributing to the JS community, you’re better off writing in JavaScript. More people will contribute and/or adopt your code. Quality, not quantity. Maybe the higher quality contributors are more likely to get excited about a cs project over js.

Initially I got excited about CS, until I discovered that it forbids shadowing and conflates variable declaration with assignment at the same time, leading to random bugs happening all over the place as I introduce a name that I've used somewhere in a deeper scope. No, identifier names are one of the big problems of all languages and CS gives you even less name locality. Bad.

Re: CoffeeScript's Time is Waning For Me

#16
post #5
post #2

"As my project grows in size, significant whitespace becomes more and more of a problem. It’s just plain not readable or visually parsable. Your files become a wall of dense text. Damn you Python, damn you to hell!" I would appreciate an explanation of this paragraph. How exactly does project size compound issues with significant whitespace? Are you indenting five levels or something?

I'm curious about this statement as well. It sounds like the author might be: - Creating big complex methods instead of breaking code into smaller (testable) ones? - Nesting callbacks multiple levels deep, instead of using something like Node Async to flatten out code flow? - Choosing a Coffeescript code style that leads him to put callbacks on their own line, or something like that? - Something else? Not implying th…

I'm the author of the blog post. Significant whitespace is pretty dividing, and really boils down to preference. I have a strong dislike for it, and have avoided any language with it, CoffeeScript being the only exception.

Here is a typical snippet of my code as seen in my editor: http://i.imgur.com/2yVhgcz.png

IMO, those four methods really bleed together and are hard to discern, not to mention the if statements. I also think for the most part I stick with code that's "whitespace friendly", getAll there is a really long method by my standards.

Yeah, I could put more blank lines between the methods and probably some other things. But I also think a closing brace or an 'end' makes a world of difference. Really helps break up the space and compartmentalize it.

Not everyone thinks this of course. For many code like this is just fine. Like I said, it's all preference.

Re: CoffeeScript's Time is Waning For Me

#17
post #16
post #5

Earlier quoted context omitted.

I'm curious about this statement as well. It sounds like the author might be: - Creating big complex methods instead of breaking code into smaller (testable) ones? - Nesting callbacks multiple levels deep, instead of using something like Node Async to flatten out code flow? - Choosing a Coffeescript code style that leads him to put callbacks on their own line, or something like that? - Something else? Not implying th…

I'm the author of the blog post. Significant whitespace is pretty dividing, and really boils down to preference. I have a strong dislike for it, and have avoided any language with it, CoffeeScript being the only exception. Here is a typical snippet of my code as seen in my editor: http://i.imgur.com/2yVhgcz.png IMO, those four methods really bleed together and are hard to discern, not to mention the if statements. I…

Try removing the indentation guides or decreasing their contrast so that they are just barely visible. They appear to cause strong visual grouping between code blocks and make it harder to see what's what.

Re: CoffeeScript's Time is Waning For Me

#18
post #17
post #16

Earlier quoted context omitted.

I'm the author of the blog post. Significant whitespace is pretty dividing, and really boils down to preference. I have a strong dislike for it, and have avoided any language with it, CoffeeScript being the only exception. Here is a typical snippet of my code as seen in my editor: http://i.imgur.com/2yVhgcz.png IMO, those four methods really bleed together and are hard to discern, not to mention the if statements. I…

Try removing the indentation guides or decreasing their contrast so that they are just barely visible. They appear to cause strong visual grouping between code blocks and make it harder to see what's what.

That's a fair point. I will try that and maybe some more tweaks too.

Re: CoffeeScript's Time is Waning For Me

#20
The author uses CoffeeScript for completely different reasons than I do. While a lot of the convenience features of CoffeeScript are awesome, I use CoffeeScript more to compile JS to standards-compliant, consistent code. Variables are hoisted, commas are automatically inserted, semi-colons are taken care of, and the entire script is put into a lovely self-invoking function that helps fool-proof things.

Furthermore, because CoffeeScript requires (sort of) a compilation step, errors are caught and debugging becomes MUCH easier than it ever was with plain JavaScript. Most text editors now have plugins that will compile selected text to JavaScript so you can preview the end result and make sure that you're getting the output you want.

The better part? When JavaScript best practices evolve, CoffeeScript can evolve with it, but the code can more-or-less stay the same. Awesome!

Post reply on HN