Earlier quoted context omitted.
The problem I have with clojurescript is i couldnt find any closurescript tutorial that did not involve java. Let's say i want to start using closurescript,like coffeescript. i want to do npm install -g closurescript then closurescript compile myscript or closurescript myscript. How do I do that? If closurescript folks want their language to be popular with javascripters i need to be able to do that. Right now,search…
npm depends on a javascript compiler such as g8 so how is that different than clojurescript depending on the JVM ?! It's no different at all you're just complaining that you don't like to have to install software before using it which is ridiculous if you want to use powerful software.
Why CoffeeScript Isn't the Answer
131–140 of 148 posts
Re: Why CoffeeScript Isn't the Answer
#132Disclosure: I have never used CoffeeScript. However, based on the article, the death-knell against CoffeeScript for me was the variable scoping rules. With no variable declaration keyword (a la var, my, local, private), adding a variable assignment anywhere could radically change the variable scoping. I'm done, this isn't suitable for prime-time, time to go somewhere else. I spent too many years in the 80s working wi…
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.
Re: Why CoffeeScript Isn't the Answer
#133Earlier quoted context omitted.
What would the code look like for my example using futures in JavaScript?
fs.readFile("person.json") .then(function(e, personJson) { var person = JSON.parse(personJson); return myDB.query("lastname", person.name); }) .then(function(matched) { return msgQueue.push(JSON.stringify(matchesLastname)); }) .then(function(id) { log.info("Message sent to queue: " + id); });
Re: Why CoffeeScript Isn't the Answer
#134Earlier quoted context omitted.
fs.readFile("person.json") .then(function(e, personJson) { var person = JSON.parse(personJson); return myDB.query("lastname", person.name); }) .then(function(matched) { return msgQueue.push(JSON.stringify(matchesLastname)); }) .then(function(id) { log.info("Message sent to queue: " + id); });
That's part of it. What about creating the promises?
var readFile = Q.denodeify(FS.readFile);
which doesn't create the promise. it just wraps the readFile method so that it returns a promise when you call it.Re: Why CoffeeScript Isn't the Answer
#135Answer to what? What's wrong with Javascript in the first place?
Not being able to import/include library code is bat-shit insane. You can't reliably check the type of things like arrays.
The 'this' value is 'wrong' in callbacks (by wrong, I mean, not what programmers actually need in that instance).
Javascript dates values are 1-based except for months which are zero based - be consistent!
Math.parseInt will produce correct results for 05, 06, 07, wrong results for 08, 09 - don't ASSUME a radix! (unless that radix is base 10).
It goes on regardless in the face of a large number of errors meaning that the location of an error can be much harder to find than is necessary - I believe that fail fast is infinitely superior to 'just muddle through and do something random with that invalid state'
You can't rely on getting decent stack traces out of it on error which makes debugging harder than it should be.
It's easy to accidently add globals.
I'd add lack of types: obviously that's a preference but when 30% of your tests just end up checking what a compiler could have done for you for free, then I say that;s a fault with the language.
That said, I really like array and object literals. It's not all bad. Just... about 86%
Re: Why CoffeeScript Isn't the Answer
#136This is not the first article talking about CoffeeScript's ambiguity and readability issues. It's interesting how CoffeeScript fans almost always decide to blame the programmers for these problems. They said good developers should use common sense and use best practices to make code readable, for example by always using parentheses when calling functions. I hear exactly the same argument in the Perl community. But re…
Re: Why CoffeeScript Isn't the Answer
#137I 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…
I find your code reads naturally enough forward. Your abstract brief example makes it no big deal to me which way round it goes.
One issue is "end weight". Let me slightly doctor the examples in http://perl.find-info.ru/perl/028/perlbp-chp-2-sect-16.html and ask you to compare:
When, after long nights of hacking, in horrible dreams there come to me damnèd souls responsible for ANSI C++, I run screaming.
with:
I run screaming when damnèd souls responsible for ANSI C++ come to me in horrible dreams, after long nights of hacking.
If I were writing one of the above two sentences, "end weight" consideration might lead me to write the latter.
If one applies these principles (left-to-right sweep and "end weight") to writing and reading of programming language statements one arrives at features such as the 'unless' keyword and the benefits they supposedly confer on writers (expressivity) and readers (ease-of-reading).
Re: Why CoffeeScript Isn't the Answer
#138Re: Why CoffeeScript Isn't the Answer
#139However, this part I completely agree with:
> Realistically, the issues I have raised with CoffeeScript don’t come up every day. Ultimately though, they are enough to say we need something better. I hope to share some thoughts soon on what such a solution might look like.
CoffeeScript isn't perfect and we should always be looking for better solutions. So I'm glad that the author wants to add to the discussion. While CoffeeScript isn't the answer, it's probably the best answer we have so far,