Earlier quoted context omitted.
Agreed. I was responding more to the assertion that CoffeeScript doesn't have a problem with variable scoping rules. It does and the consequences are scary.
You're right that the scoping rules in CoffeeScript are unintuitive for someone coming from a statically-typed, declare-everything paradigm. But I'd hesitate to call it a problem. It's a feature not a bug that the same symbol in nested scopes always refers to the same variable. As I said previously, I believe code that relies on variable shadowing to work correctly is broken. I've been hit by the scoping rules many t…
Why CoffeeScript Isn't the Answer
141–148 of 148 posts
Re: Why CoffeeScript Isn't the Answer
#142I do have some frustrations with CoffeeScript as outlined here - I find the unless keyword infuriating because it forces me to read backwards: a = 123 unless b == 2 "OK, so a is set to 123. Oh, unless b is 2. That's annoying" That said, my answer is to just not use the unless keyword. If you don't like CoffeeScript classes, you don't have to use them. IMO you could write CoffeeScript using only the kind of functional…
element.setValue value unless no_change
I'd read this example as: In most cases, we set the value of the element. However, sometimes there haven't been any chances, so there's no need to set any new value.Of course, I could write it as, for example
if change
element.setValue
but to me, however, although the end result is the same, that second example does not convey the same message to me as the first. In the second example, I'd interpret the normal situation as there being no change, but if there is one, update the element.I think that's also the reason why I like programming in ruby. I feel I am able to better express my understanding of the situation in code than I could if these seemingly syntactical sugary bits weren't there. I also think it is mostly a matter of personal preference.
Re: Why CoffeeScript Isn't the Answer
#143Earlier quoted context omitted.
I've used coffeescript extensively for years, and I have never had that be an issue. Not sure if it's because I rarely write a file longer than ~200 lines, or I'm careful about variable names and global scope. More generally I've found that coffeescript mixes much better with a functional style than with an imperitive one.
This, to me, sounds just like Douglas Crockford when he dismisses all the evils of Javascript as "things that never happen to him". Which is interesting, given that they occur to me and my work mates on a fairly regular basis.
Re: Why CoffeeScript Isn't the Answer
#144Earlier quoted context omitted.
This, to me, sounds just like Douglas Crockford when he dismisses all the evils of Javascript as "things that never happen to him". Which is interesting, given that they occur to me and my work mates on a fairly regular basis.
I don't think the gist is that there aren't problems with these languages, but that with a little carefully placed construction tape, you can avoid falling into the large holes.
Re: Why CoffeeScript Isn't the Answer
#145Earlier quoted context omitted.
I don't think the gist is that there aren't problems with these languages, but that with a little carefully placed construction tape, you can avoid falling into the large holes.
Yeah, people say the same thing about C++. It's great when you have your own carefully curated subset of the language.... and then you have to deal with other programmers & libraries
Re: Why CoffeeScript Isn't the Answer
#146> from the CoffeeScript tutorial...Furthermore, until you finish reading the line it isn’t clear which foods will be eaten.
The thing with typing the filter at the end is, that format has its basis in mathematical notation, particularly in set theory. Using an even terser mathematical syntax/notation, you could write the same expression this way:
{ eat(food) : ∀ food ∈ { foods } ^ food ≠ "chocolate" }
You read that as "the set of eat(food) where for all food in the set of foods, the food isn't chocolate". The notation will be quite familiar to mathematicians, and thus if you have a strong mathematical background, especially in set theory, discrete math, and combinatorics, the CoffeeScript array comprehension feels natural.See the Wikipedia article on Set-nuilder Notation/Set comprehension, http://en.wikipedia.org/wiki/Set_comprehension.
Here's another example from the Wikipedia article:
{ x | x ∈ R ^ x = x^2 }
This reads as "the set of all x, where x is a real number and x = x^2", which evaluates to the set { 0, 1 }.Re: Why CoffeeScript Isn't the Answer
#147>> Why CoffeeScript Isn't the Answer What is the question for which CoffeeScript is a compelling answer? "I needed to speak to Germans, so I learned French and spoke through a French-German interpreter. Things were occasionally lost in translation and somteimes I couldn't get my point across, but French is prettier. Can I recreate this experience in code?" "My team can't learn to write `var` or `===`. Can we just lea…
http://en.wikipedia.org/wiki/Status_quo_bias CoffeeScript obviously solves problems. Its not compelling to you because of status quo bias, and because you don't want to invest the effort to learn it. The issue with equality is a real issue. CoffeeScript solves that issue. Braces and parenthesis _do_ become awkward in JavaScript with callbacks. CoffeeScript solves that problem. You have been able to debug CoffeeScript…
What problems do you think coffeescript solves?
Re: Why CoffeeScript Isn't the Answer
#148Ok, so if CoffeeScript is just JavaScript, add the parenthesis. If you need brackets to make a section of code readable or compile to "certain" JavaScript, then add them. Even the programs I work on we add parenthesis, brackets, etc for readability. Use CoffeeScript to increase productivity. Nowhere does CoffeeScript say you must use white space instead of brackets and such. Keep it simple and easy, classes are also…
There are still two sides in programming, it seems. And interestingly enough it's not necessarily static vs. dynamic or procedural vs functional. One the one hand you have pragmatic, loosey goosey languages like perl, javascript, ruby, even scala and C#. An important defining characteristic being perl's maxim "there's more than one way to do it". On the other hand you have what I'd call the "bondage and discipline" l…
I can't believe you just compared python to java for B&D. Which language forces you to catch ever exception raised?