Hacker News new | ask | show | jobs
by joemoon 5027 days ago
> Just because you CAN do something in CoffeeScript doesn't mean you SHOULD, or should ALL of the time. Just like in JavaScript where, if you want, you can write all of your code on one line, but you shouldn't.

Isn't this precisely the problem? Why make a better Javascript then make the same mistakes as the original? One of the main goals is for Coffeescript to be more readable that Javascript. Having ambiguous syntax and so many different ways of doing things means that people will write code in all of these different ways.

Your rebuttal is a long list of what you SHOULD and SHOULDN'T do, but there are two problems:

1. Not everyone will agree with you.

2. People will write it the "bad" way anyway.

Ultimately this means less readable code, especially when you have to read someone else's code.

3 comments

> 2. People will write it the "bad" way anyway.

People will write bad code in every programming language you give them. I don't see that as a justification for limiting the expressiveness of a language. If you take that line of reasoning too far you end up with Java.

> I don't see that as a justification for limiting the expressiveness of a language.

That's a straw man. I never said that the expressiveness of the language should be limited. There are plenty of languages that are just as (more?) expressive than CoffeScript without the syntactical ambiguity.

> If you take that line of reasoning too far you end up with Java.

That's the slippery slope fallacy. I am in no way suggesting that CoffeScript should have completely rigid syntax. Surely there is a happy medium between CofeeScript and Java. There are plenty of languages that live there.

Or python, which is where the author is coming from. In python there are fewer syntactic ways to write the same thing (semicolons aren't optional, they're just not permitted. The only ways to write and and or are 'and' and 'or', '&&' and '||' simply don't exist. Map literals always look like {key1: value1, key2: value2}, the braces are non-optional ).

Even python's critics would admit it's a very readable language, and it would be unusual to claim it's not expressive.

A nitpick: you can use semicolons in Python.

    x = 3;
The slope slips both ways. If you don't take that line of reasoning far enough you end up with Perl.
> as a justification for limiting the expressiveness of a language

Is it really more expressive just because there are N ways to do it?

Exactly. Expressiveness refers to the realm of problems a language can idiomatically address, not the number of ways a particular unit of logic can be equivalently written. If that were true, you could simply add any synonym for "if" ("when", "whenever", "assuming", "given" etc) to a language and claim the most "expressive" language.
Agree. When they invent a new language to fix some problems of the old one, if same problems (even more) appear in the new one, then why you need the new one? That's funny they try to fix some traps by introducing more pitfalls. What's the point? Those problems can be avoided by design, but they didn't.

In short, it was badly designed. Pointless to use it.

Also, his rebuttal doesn't defend the inclusion of those language features in the first place. If you simply "shouldn't" use a particular feature (e.g. if at the end of an expression), why should it be in the language at all? It shouldn't, ergo the language is nonsense, which was the original claim.