I’ve not had this experience. I’ve found the ambiguity in coffeescript a maddening adventure in syntax confusion.
- function call syntax doesn’t need parens except if a 0 parameter method
- commas are largely optional both in arrays and function parameters. How do you parse: [f, f(), f a b c]
- implicit returns are a terrible idea.
- the @ syntax refers to either a ‘static’ method or an instance variable depending on the context.
- I have to do a double take for the object literal syntax every time
> function call syntax doesn’t need parens except if a 0 parameter method
Function call syntax doesn't require parens so to make multi-line calls punctuation-free. Especially if some args are objects.
> commas are largely optional both in arrays and function parameters. How do you parse: [f, f(), f a b c]
Well commas are not optional.
> implicit returns are a terrible idea
They're especially elegant in writing declarative code. It takes some getting used to though.
> the @ syntax refers to either a ‘static’ method or an instance variable depending on the context.
Agreed.
These are all tradeoffs though. For me, they struck the right balance between ambiguity (very little) and expressiveness.
LiveScript in comparison was much more sugary (which I preferred): https://livescript.net/
Well, guess it's Reason for me now :D
Reading other people's CoffeeScript on the other hand...
I really miss the elegance of Coffeescript. ES6 is great, Typescript is great, but sometimes I feel like I have to visually parse a lot of static cruft to read the essence of the program.
What if one's editor had a toggle hotkey to hide typescript typings. Maybe you could turn it off to visually parse the program real quick, before turning it back on to edit it.
Hmm...
When it comes to experimentation, I love Javascript and Python because of how fast they are to write when you're not thinking hard about types.
Then it's just discipline to know how to promote experiments to production code. TypeScript is beautiful because you can just turn it on and add them in. Same with Python type hints.
TS is what happens when you let .net devs write JS.
Let's see how that turns out in the long run.
Indeed, Coffeescript is one of the finest languages I wrote in. Consider that 95% of the time we are reading code, what is the win of TS with a linter? The TS codebases I've worked on really hurt my eyes and brain, and that for some stupid website where type safety hardly makes any difference at all. And all those average web developers I've worked with bragging about type safety while the code they are producing is full of wrong constructs, bad naming, dependent on heavy tooling, etc..
Reading my old code, I was surprised by how clean it looks. How easy it is to digest. There is a certain sense of calm when your brain doesn't have to process all the visual clutter of a C-style syntax. I miss that.
I wish I didn't have to choose between CoffeeScript and TypeScript.
TypeScript first and foremost is about type safety and tooling. Its architecture is largely syntax-agnostic. It operates on the AST, so the parser and code generator can be swapped for a different syntax.
CoffeeScript is all about syntax and does not (and should not) concern itself with most of the semantics.
They could theoretically be used together if TypeScript simply allowed custom parsers/generators/formatters to be plugged in.
This would work with ESLint and other JS tooling as well. I did a POC on that a few years ago [0].
[0] https://github.com/gkz/LiveScript/issues/821#issuecomment-18...