Live data from Hacker News

CoffeeScript's Time is Waning For Me

mattgreer.org

41–50 of 67 posts

Re: CoffeeScript's Time is Waning For Me

#41
post #18
post #17

Earlier quoted context omitted.

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.

Seems like you really have a lot of contrast in that theme. Also I hope you will consider dropping the extra parentheses.

And instead of dropping CoffeeScript I hope you will try out ToffeeScript. But just use the basic ! thing, you don't need the other stuff like auto callback.

    e, data1 = fs.readFile! 'foo'
    e, data2 = redisclient.get! "thekey"
    console.log data1
    console.log data2

Re: CoffeeScript's Time is Waning For Me

#43
post #7
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.

Maybe, but many JS programmers won't touch anything CS.

http://js2coffee.org/

/s

Re: CoffeeScript's Time is Waning For Me

#44
post #8

Unlike the author, I love significant whitespace and am enjoying nimrod lately with it. I'd love to see a CoffeeScript variant for TypeScript. TypeScript has the structural things of CoffeeScript and more (OO paradigms, member visibility, modules, typing, etc) but much more verbose. I have tinkered w/ the CoffeeScript grammar/parser adding in a backslash to denote to type (e.g. "(x\int) -> x * x") and the TypeScript…

I love CoffeeScript and am excited about nimrod, but I don't see the point of TypeScript. Honestly I am fairly certain that it was largely created by Microsoft as part of the EEE strategy (http://en.wikipedia.org/wiki/Embrace,_extend_and_extinguish) since the main advantage of JavaScript is not having to supply types.

Re: CoffeeScript's Time is Waning For Me

#46

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.

This is how I do setTimeout:

  delay = (ms, func) -> setTimeout func, ms
So you can write it like this:

  delay 100, -> console.log "100 ms passed"

Re: CoffeeScript's Time is Waning For Me

#47
post #41
post #18

Earlier quoted context omitted.

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

Seems like you really have a lot of contrast in that theme. Also I hope you will consider dropping the extra parentheses. And instead of dropping CoffeeScript I hope you will try out ToffeeScript. But just use the basic ! thing, you don't need the other stuff like auto callback. e, data1 = fs.readFile! 'foo' e, data2 = redisclient.get! "thekey" console.log data1 console.log data2

When I first started using CoffeeScript I dropped just about every optional character you could. Lately I've been going in the opposite direction and adding most of them back in. I find this is also a matter of taste and experience. Whether I add the parens or not depends a lot on what's going on at that point. I do appreciate how flexible CS can be here.

I'm interested in things like ToffeeScript and JS generators. I do like what they do for code readability.

Re: CoffeeScript's Time is Waning For Me

#48
post #15

Earlier quoted context omitted.

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.

I'd argue that that's a feature. You're asking for decreased code comprehension and bugs when you start using identical variable names everywhere. I have noticed a lot of "Issues" in the CoffeeScript repo from angry hackers that were mad that CoffeeScript forces them to code with some modicum of responsibility (no drop-throughs in switch statements, no var shadowing, etc.). Doesn't make sense to me why people would b…

No, I'm not asking for bugs. I'm asking for a basic feature of natural languages: to define a context where I work, where short, concise words have a precise meaning. This is an elementary thing - its the basis behind namespaces, the drive behind object oriented programming. Its a fundamental design mistake to put limits on this.

But its worse, because its also a silent mistake. Shadowing could be forbidden but variable declaration and assignment could still be different things, and then the compiler could warn you when you try to re-use a name. But no, coffee script will give you random bugs instead.

JavaScript has its rough edges. CofeeScript simply has a rot right in its core.

Re: CoffeeScript's Time is Waning For Me

#49
post #15

Earlier quoted context omitted.

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.

I found it helps clear up your naming habits and avoid short names, which are a major source of opaqueness in code.

On the contrary, short names are a source of clarity and expressiveness. Humans convey so much information through context, and shadowing nicely allows us to at least approximate that.

But I would be okay with this stance (yet would not use coffeescript) if the language had a mechanism to warn you when you're trying to reuse a name. Instead the language's features combine in a way that will clobber your code and lead to subtle or not-so-subtle bugs.

Re: CoffeeScript's Time is Waning For Me

#50
Can anybody explain some good use cases of implicit return? When I was doing a project in CoffeeScript last year (the only time I've used it), I found myself just using the return keyword explicitly because it was more readable, and I never ran into the issue the article talks about where it can be bad to accidentally return something from a function that should return null/undefined.

When would implicit return make code better? Maybe I'm answering my own question, but I can see them being more readable to somebody coming from a Haskell or LISP background than to somebody like me who has worked mostly in C, Java, and Python.

Post reply on HN