Earlier quoted context omitted.
You may have been misinformed -- the values of direct, raw, fast code are a big part of the reason why CoffeeScript works the way it does, and why many scripts can end up running faster after getting ported to CoffeeScript. The golden rule of CoffeeScript is to avoid adding any library code to the runtime, and to avoid introducing any special calls, to the greatest extent possible. Many folks rely on a "forEach" (or…
I'd write that snippet the following way: for (var i = 0, ii = list.length; i Or: for (var i = 0, ii = list.length; i There are ways to make normal JavaScript not look ugly ;) EDIT: fixed minor oversight
Poll: Have you moved from JavaScript to CoffeeScript?
121–130 of 178 posts
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#122Earlier quoted context omitted.
You may have been misinformed -- the values of direct, raw, fast code are a big part of the reason why CoffeeScript works the way it does, and why many scripts can end up running faster after getting ported to CoffeeScript. The golden rule of CoffeeScript is to avoid adding any library code to the runtime, and to avoid introducing any special calls, to the greatest extent possible. Many folks rely on a "forEach" (or…
I'd write that snippet the following way: for (var i = 0, ii = list.length; i Or: for (var i = 0, ii = list.length; i There are ways to make normal JavaScript not look ugly ;) EDIT: fixed minor oversight
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#123When I first saw CoffeeScript I thought it was the best thing since sliced bread. I mean, it's beautiful to look at (and enjoyable to write). I was positive that it was going to replace JavaScript in my toolbox. Except, for whatever reason, it never did. It may just be because regular old JavaScript is already familiar, but whenever I needed to knock out any client-side code I'd have half the thing written in JS befo…
you can try js2coffee which will convert all existing js file to coffee-script.
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#124Earlier quoted context omitted.
you can try js2coffee which will convert all existing js file to coffee-script.
I see no need to convert my js to coffee just so I can compile it back to js.
But two points:
1) The syntax wasn't the only thing that drew me to Ruby. 2) I just don't see an any real need morph my JS code into a similar syntax. Writing JS is pretty easy.
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#125I started writing some of my code in coffeescript a while ago, but then I started a coffeescript project that grew into a file of 2000 lines and it became very hard to skim the code and gather meaning from it because of the lack of parenthesis and the indentation-based nature of it.
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#126This is going to be a very interesting poll result. Even 5 or 10% penetration is something remarkable, for a language as widely-used as JavaScript. If you feel like providing any more color beyond your vote, your impressions after using CoffeeScript in anger -- I'd love to hear 'em.
In terms of complaints, I'd say the main one is a few things missing from the big page of documentation that's on coffeescript.org - #'s are comments, function calls with multiple arguments need to have the left paren start immediately after the function name, how to pass anonymous functions. Those cost me a few hours taken together starting out.
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#127Earlier quoted context omitted.
I'd write that snippet the following way: for (var i = 0, ii = list.length; i Or: for (var i = 0, ii = list.length; i There are ways to make normal JavaScript not look ugly ;) EDIT: fixed minor oversight
The small bug in your code actually makes a good case for using the more concise syntax of coffeescript to help avoid those kinds of errors, while generating code that's just as efficient.
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#128I have used Javascript exclusively on client and server since late 2008. First Rhino and then Node. Before that I used Rails. I can understand the syntax gripes that some people have towards Javascript but I think this has more to do with a Ruby notion of "elegance" coupled with a lack of familiarity with Javascript then it does with actual issues with Javascript. In fact, I prefer Javascript to Ruby. I have gone the…
You may have been misinformed -- the values of direct, raw, fast code are a big part of the reason why CoffeeScript works the way it does, and why many scripts can end up running faster after getting ported to CoffeeScript. The golden rule of CoffeeScript is to avoid adding any library code to the runtime, and to avoid introducing any special calls, to the greatest extent possible. Many folks rely on a "forEach" (or…
Let me rewrite it for you: 1)
var list = [{amount:2}, {amount:5}], i, sum = 0;
for (i = 0; i console.log(sum);
2) Or let's go even more simple...
var list = [{amount:2}, {amount:5}], i, sum = 0;
for (i in list) { sum += list[i].amount; }
Personally, i don't find anything difficult about that.. Actually looks incredibly simple. What are you actually saving by using Coffeescript...? Some brackets, parens and a semi-colon? I don't know, those are just second nature for me. I've never really stopped and thought, "wow, if only I didn't have to type these extra parens, this is really killing me..."
Not once.
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#129This is going to be a very interesting poll result. Even 5 or 10% penetration is something remarkable, for a language as widely-used as JavaScript. If you feel like providing any more color beyond your vote, your impressions after using CoffeeScript in anger -- I'd love to hear 'em.
Hey. I voted 'use Coffeescript a lot and JS a little'. I like to use the best tools, so to me learning JS was just a step on the way to learning Coffeescript as soon as I had heard about it. It always boggles me when people don't want to use better tools. In terms of complaints, I'd say the main one is a few things missing from the big page of documentation that's on coffeescript.org - #'s are comments, function call…
Re: Poll: Have you moved from JavaScript to CoffeeScript?
#130Earlier quoted context omitted.
You may have been misinformed -- the values of direct, raw, fast code are a big part of the reason why CoffeeScript works the way it does, and why many scripts can end up running faster after getting ported to CoffeeScript. The golden rule of CoffeeScript is to avoid adding any library code to the runtime, and to avoid introducing any special calls, to the greatest extent possible. Many folks rely on a "forEach" (or…
Yah but your example for Javascript uses some dubious code. Did you know that "for .. in" loops are also native to Javascript? Why not use one for JS, why only Coffeescript? Also, it seems like you are doing some useless variable declrations. Let me rewrite it for you: 1) var list = [{amount:2}, {amount:5}], i, sum = 0; for (i = 0; i console.log(sum); 2) Or let's go even more simple... var list = [{amount:2}, {amount…
The other "complexities" in the compiled JavaScript are there for perf reasons (not accessing the "length" properties in the condition portion of the for loop, for example).
Your comment underlies why some users find CoffeeScript useful in dealing with some of the idiosyncrasies and performance minutiae associated with JavaScript.