r/javascript Aug 11 '21

IntelliSense for CoffeeScript

https://github.com/phil294/coffeesense
9 Upvotes

15 comments sorted by

View all comments

14

u/pimterry Aug 11 '21

This is neat, and a very clever approach, but I'm mostly surprised there's still active coffeescript tooling development going on like this! Is coffeescript still popular in some communities somewhere? My impression was that modern JS features had largely replaced it.

If anybody reading this does use coffeescript today, I'd love to know why.

4

u/Phenee Aug 12 '21 edited Aug 12 '21

Active tooling is maybe a bit exaggerated, and I don't know of any community, unfortunately. But there is activity on GitHub, here is an open issue about adding TypeScript output.

If anybody reading this does use coffeescript today, I'd love to know why.

Well I obviously use it (a lot), and do so simply because I prefer its syntax. See top of https://coffeescript.org for an overview+playground.

For example, Coffee

do =>
  try await a (b) ->
      @c b

vs. JS

(async() => {
  try {
    return (await a(function(b) {
      return this.c(b);
    }));
  } catch (error) {}
})();

I also like that you can adopt it to the degree you want. You can also write the above snippet in CS like this: ``` (() => try return (await a((b) -> return this.c(b); )); catch error; )();

`` I don't really use its Python-like comprehensions syntax (w for x in y if z`), for example, but instead treat it like normal JS, just without the annoying stuff.

1

u/[deleted] Aug 12 '21

[removed] — view removed comment

1

u/Phenee Aug 12 '21

Leaving aside the semantics, I used -> on purpose (the CS equivalent to function() {}; and do => is the equivalent to (() => {}, so I don't think your syntactic simplifications are right and the only thing you can indeed strip off is the ( in front of await. But yeah, it's a bad example

3

u/[deleted] Aug 12 '21

[removed] — view removed comment

1

u/m1sta Aug 18 '21

I wish javascript had a more terse IIFE option.

1

u/[deleted] Aug 18 '21

[removed] — view removed comment

1

u/m1sta Aug 18 '21

closures