Live data from Hacker News

Discourse ditches CoffeeScript

meta.discourse.org

21–30 of 84 posts

Re: Discourse ditches CoffeeScript

#21
post #19

Did they? I can't get to the end of the thread 'cause their infinite scroll thing is not working on mobile safari. Looks like they should focus on coding instead.

our mobile story sucks at the moment, we are dying for a mobile friendly skin at the bare minimum, contributions totally welcome. you can get it to work on mobile safari in portrait if you zoom in / out ... but that just too hacky

Your web-site also sat with the spinner running for 4+ seconds.

You might want to try providing it in HTML format.

Re: Discourse ditches CoffeeScript

#22
post #7

Earlier quoted context omitted.

CoffeeScript's scoping is broken. http://lucumr.pocoo.org/2011/12/22/implicit-scoping-in-coffe...

I greatly prefer Scheme-like lexical scoping. However, JavaScript does not implement lexical scoping properly. Given the particularities of JavaScript's inadequacies, I think that the CoffeeScript design is very reasonable. It's certainly not "broken". Lots more discussion here: https://news.ycombinator.com/item?id=3379962

BTW, ClojureScript has proper lexical scope.

Re: Discourse ditches CoffeeScript

#23
I developped a little layout library ( work in progress ) which is a port of a flash lib. and frankly coffeescript made it really easy and made me wrote far less code that pure javascript.

One can write readable code with Coffeescript , i use parenthesis in big scripts because it is more readable , and i dont use classes where not appropriate.

CS helped me write better javascript without the badparts so i dont need to be a human compilator and fix javascript each time i write it. I should not have to.

http://mparaiso.github.com/Coordinates.js/

It is not for everyone , but significant white spaces are not a problem if one is used to indent his code properly. I tried typescript too , which is good, but i found coffeescript more expressive. The truth is , i enjoy writing CS , i dont writing JS.

Re: Discourse ditches CoffeeScript

#24
post #20

> CoffeeScript has significant whitespace. So instant no. It makes it a pain in the butt to parse. It's annoying. Most people (except for Python developers) don't like it. Due to being difficult to parse, you will have problems when you try to refactor. Not to mention the problems of re-indenting everything when you have really long and ugly blocks you want to clean up (happens). maybe people should stop writing unin…

No one is writing un-indented code. The issue is lack of metadata for automatic indentation.

In C if I shift a block of code a quick gg=G will reformat and reindent. Possible because blocks are explicit and whitespace is separate from scope. By the same token autogeneration of {}'s is impossible in C. This is obvious but obfuscated in Python from whitespaces' overloading.

The issue is autogeneration of blocks. In any language blocks are a fundamental aspect of programming. Blocks affect the function of a program. Since we lack self-programming computers we also lack autogeneration of blocks. Python's issue is that a non-fundamental aspect of programming has been paired with a fundamental aspect of programming.

Re: Discourse ditches CoffeeScript

#25
post #7

Earlier quoted context omitted.

CoffeeScript's scoping is broken. http://lucumr.pocoo.org/2011/12/22/implicit-scoping-in-coffe...

I greatly prefer Scheme-like lexical scoping. However, JavaScript does not implement lexical scoping properly. Given the particularities of JavaScript's inadequacies, I think that the CoffeeScript design is very reasonable. It's certainly not "broken". Lots more discussion here: https://news.ycombinator.com/item?id=3379962

Um... I believe JS does have proper lexical scoping. Could you source any evidence to the contrary?

Re: Discourse ditches CoffeeScript

#26
Am I the only one that has trouble parsing this CoffeeScript? I thought the syntax was suppose to be cleaner than plain javascript:

MyApp.president = Ember.Object.create fullName: (-> @get('firstName') + ' ' + @get('lastName') ).property('firstName', 'lastName')

How the hell am I suppose to read that?

Re: Discourse ditches CoffeeScript

#27
post #26

Am I the only one that has trouble parsing this CoffeeScript? I thought the syntax was suppose to be cleaner than plain javascript: MyApp.president = Ember.Object.create fullName: (-> @get('firstName') + ' ' + @get('lastName') ).property('firstName', 'lastName') How the hell am I suppose to read that?

Are you familiar with CoffeeScript? I've been developing in it for more than 6 months now and that code is perfectly readable to me. Granted, I wouldn't say it's very good code -- I would probably split that into two lines just so it looks less intimidating. But I can assure you, once you get into the swing of it, that's not some intelligible mess -- you can most certainly understand it. And if you don't? Just take a peek at the compiled JS.

Someone said that CoffeeScript is designed to be more writable than readable, and I'd tend to agree with that. But frankly, after having worked with it for the better part of a year, I prefer reading it than JS for just about everything. It's an acquired taste, but don't knock it till you try it :)

Re: Discourse ditches CoffeeScript

#28
post #5

If you understand programming (there is a difference between knowing how to program and understanding, a lot of people lack the latter) there is absolutely no difficulty learning CS if you know JS. I've been coding CS for over a year now and I like it, I've never found it hard to debug and it's just easier to read.

I've made some pretty large apps in CS, by myself and in teams. So many good things in CS that I can no longer live without when writing front-end code:

1. @ = this

2. -> to => solves almost every context problem

3. Object notation by simply using colons ':'

    $('body').css
      color: 'red'
      background: 'blue'
4. statement if condition

5. jsondata?[2]?.hierarchy?.url

6. Optional brackets allow very terse/clean code:

    setTimeout ->
      statement
    , 1000
7. (function_argument = 'default_value') ->

8. Automatic return on last line

9. I also like how CS handles scoping, even though others might not. My very few globals are ALLCAPS and everything else is local scoped. I don't do things like {log, tan} = Math in the global scope just to save a few keystrokes elsewhere.

Add jQuery/Backbone/Underscore/Bootstrap to the mix and you can develop some very large, complex apps with CS in a very clean way. Of course, people may not like some of the above syntax but I love not having to write/parse 2x as much code.

Re: Discourse ditches CoffeeScript

#29
post #26

Am I the only one that has trouble parsing this CoffeeScript? I thought the syntax was suppose to be cleaner than plain javascript: MyApp.president = Ember.Object.create fullName: (-> @get('firstName') + ' ' + @get('lastName') ).property('firstName', 'lastName') How the hell am I suppose to read that?

Edit: previous example was incorrect as pointed out by klibertp below. Hopefully they're correct now...

it's not exactly a shining example of good coffeescript, but I think this is equivalent js

    MyApp.president = Ember.Object.create({
        fullName: function(){
            return this.get('firstName') + ' ' + this.get('lastName');
        }.property('firstName', 'lastName')
    })

I'd probably write it in cs as

    MyApp.president = Ember.Object.create
        fullName: (
            -> "#{@get 'firstName'} #{@get 'lastName'}"
        ).property('firstName', 'lastName')
(ie multi line rather than a single line) but that's very much just stylistic choice. It's also a lousy example of the benefits of cs as the cs version doesn't add any benefit over the plain js one.

Re: Discourse ditches CoffeeScript

#30
If I've understood correctly, the most compelling argument (or at least the most seemingly objective one) is that CoffeeScript conflicts with planned features of ES6+, meaning that there is a risk that large CoffeeScript projects will be locked into the ES5 feature set.

Since Discourse is planning on being around long after ES6 becomes widely available, it was a winning argument.

http://meta.discourse.org/t/is-it-better-for-discourse-to-us...

Also, one of the big reasons the Discourse devs liked CoffeeScript is because it makes it hard to commit common JS errors. Building JSHint into their workflow can help bring this protection back.

Post reply on HN