Hacker News new | ask | show | jobs
by Destroyer661 5013 days ago
Out of all the languages to choose from it just had to be coffescript...
1 comments

It's my main language for almost two years now ;)
First they ignore you, then they ridicule you, then they fight you...

...than u rule da web.

I'm not saying that it being your main language is bad, it's just the syntax is absolutely terrible to read and understand for those of us on C-style languages. If the point was to teach others, the vast majority of your audience is not going to be reading coffeescript and learning much.
IMHO, I don't think it is fair to suggest this.

- There are GA tutorials available in several other languages, if this doesn't work for you. Btw, if a tutorial was offered in Lisp/Haskell, would we see the same suggestion?

- For Ruby/Python programmers, this isn't hard at all to read. Familiarity with non C-style languages might be something to pick up.

- Having moved to Coffee from C-style languages, I prefer coffee. But that is just my opinion.

I think HNers should be more tolerant of language choices. That argument can't really be won.

that's funny because coffeescript is meant to be all about readability in code. I wonder if you really tried to read this or if you just commented based on the title. If you did really read it, I wonder if you found it hard to read because your opinion is tainted by those C style languages? It's not scientific of course but I just got my non coder, non technical girlfriend to read through both the coffeescript and javascript versions of this and I definitely had to explain a lot less to her with the coffeescript version, she says it's easier to read because it's structured more like plain English.
Hurrah. That's a big part of the entire premise.
In all code examples you can press the down arrow to view the horrible (c-style) Javascript source.

The javascript seems to be mainly horrible because of the coffeescript code being object oriented and its lack of a more powerful looping construct.

It looks like there is something missing in the first example in Javascript.

Population = (function() { Population.prototype.genomes = []; })();

This throws a ReferenceError because Population is not defined.

Genome = (function() {

  Genome.prototype.values = [];

  function Genome(values) {
    this.values = values != null ? values : this.initial();
  }

  Genome.prototype.inital = function(){
    return [RANDOMARRAY FROM [0-14]]
  }
})();

After this part Genome will be undefined.

Thx, forgot to copy the var statements. It's fixed now.