Live data from Hacker News

CoffeeScript 1.7.0

coffeescript.org

61–70 of 91 posts

Re: CoffeeScript 1.7.0

#62
post #8

Earlier quoted context omitted.

CoffeeScript played an important role in the development of ES6, but looking forward, it seems to have a same-but-different set of features vs. actual JavaScript, which may doom its future.

A doom dependent on full adoption of ES6 could easily be a decade out, to be fair. There aren't, as far as I know, any browsers that expose ES6 without non-standard compile/runtime flags, and we have to wait until there's enough adoption that the % of people using pre-ES6 browsers is negligible. Hell, I'm still waiting for Array::map to be dependable.

MDN publishes correct polyfills for ES5 Array functions like map, reduce and forEach. I think it's worth shipping those and using them now.

Ultimately though, wouldn't you want to use a js preprocessor that lets you write full spec ES6 and compiles down to ES4 or whatever your runtime target is? That's available today, and it doesn't confuse the meaning of class, fat arrow, variable scoping, etc.

Re: CoffeeScript 1.7.0

#63
post #53

Let's all take a moment to reflect on the elegance of the grammar.coffee file [0]. Notice how the function named 'o' provides simplicity as it plays well paren-less function calls. [0] - https://github.com/jashkenas/coffee-script/blob/master/src/g...

Here is the annotated link for that same file:

http://coffeescript.org/documentation/docs/grammar.html

Re: CoffeeScript 1.7.0

#64

What does %% do? The documentation says: a %% b is the same as (a % b + b) % b, but what is the difference between "true mathematical modulo" and the standard modulo?

I guess: -2 % 6 = -2, but -2 %% 6 = 4.

Yep. I think the name for it is true or Euclidean modulo. Here's the pull request that introduced it and two other new operators: https://github.com/jashkenas/coffee-script/pull/2887

Re: CoffeeScript 1.7.0

#65
post #25
post #5

Earlier quoted context omitted.

There has been a development of hate towards CoffeeScript in most JavaScript communities. CoffeeScript seems to be very popular in the non-JS communities that need to write JavaScript, like in the Ruby and Python web development communities. CoffeeScript was designed for non-JS coders to feel a lot more comfortable writing JS.

Like the Node.js community, when they're not busy fighting themselves over gender pronouns.

Python: fork my dongle

Ruby: _why hates you, and you're all just ghetto anyway

Nodejs: he and she are bad words.

Re: CoffeeScript 1.7.0

#67
post #3

Is coffeescript still hip? I used to read a lot about it on here, maybe a year or two. Where is it at? Mainstream?

I'm a former diehard JavaScript guy who uses CoffeeScript pretty much exclusively now.

I too resisted the initial cargo cult culling that happened in yesteryear. I picked up coffee-script probably a year or two later. I was focused on learning other skillsets prior. After finally spending the time to pick it up it's been an invaluable skill. From learning to productivity, it's a win.

Re: CoffeeScript 1.7.0

#68
post #3

Is coffeescript still hip? I used to read a lot about it on here, maybe a year or two. Where is it at? Mainstream?

I don't know if it's "hip," but I think it has a well-established place in the web development ecosystem, especially since using it is one of the defaults in Rails. Personally, I enjoy it and have been using it to build a fairly large Angular application (Java backend, oddly enough.) I've found that Coffee and Angular complement each other nicely.

Im curious, which library do you use to load the JS libraries? Do you use requireJS?

Re: CoffeeScript 1.7.0

#69
This should make consuming promises a lot more readable!

    api.get 'comments/1'
    .then transformComment
    .then (comment) ->
      appendwithEvents comment, 'click'
      cacheComment comment
    .fail console.error

Re: CoffeeScript 1.7.0

#70

Earlier quoted context omitted.

(couldn't edit parent, so) Top 3 things tl;dr Paren-free chaining (think jQuery or d3): bar = svg.append 'rect' .attr 'fill', 'papayawhip' .attr 'width', width .attr 'height', 0 .attr 'y', height .attr 'data-hover', data.slug Ellipsis for soaking up matching parameters, even if you don't want to name a variable: [first, ..., last] = arrayOfStuff lastArgumentFn = (..., last) -> last ... and generally improved source m…

Nice… I had been using '__', but it seems like this will allow you to use it multiple times in a parameter list.

It's even cooler than throwaway names [0]. You can index from the back:

  arr = [1, 2, 3]
  [..., two, three] = arr
or look for node-style callbacks...

  myFun = (..., cb) ->
    cb()
But you can't use it multiple times. That would allow for ambiguous syntax:

  # disallowed
  [..., whatAmI, ...] = [1, 2, 3, 4]
[0] https://gist.github.com/aseemk/8637896#expansion-in-array-de...
Post reply on HN