7 ms·
Discourse ditches CoffeeScript
- fourstar 14y agoIs it just me or is anyone else finding it weird viewing a thread on Discourse from HN? It's basically the same thing IMO (although obviously this is a Discourse site announcement). I just hope this doesn't become a "thing" as it's just essentially same as linking to a forum post.
- eurleif 14y agoHN sometimes links to reddit, too. Is there something wrong with linking to a forum post if it's a compelling forum post?
- ChuckMcM 14y agoI just thought it was a way for the Discourse guys to get people here to look at a 'real' thread in Discourse to get a feel for the system. If it is compelling enough to get someone to register and comment its a double benefit. That said, the annoying ones for me are links to Google+ things, the URL says "google.com" but the content is various.
- Kerrick 14y agoThat's one of the very few things HN should borrow from reddit: use subdomains in the URLs, so we could see (for example) that it's from plus.google.com.
- kmf 14y agoI think the advantage of this project being open source becomes really clear in situations like this: I'd imagine js2coffee[1] will cover most of their bases, but in the situation that it doesn't, they have a (pretty active) Github community to fall back on for the finicky bits of conversion. [1]: http://js2coffee.org/ http://js2coffee.org/
- jaredmcateer 14y agoIt's been a while since I looked at js2coffee, it's nice that they've eventually fixed the lack of transferring comments issue.
- ansman 14y agoIf 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.
- eurleif 14y agoCoffeeScript's scoping is broken. http://lucumr.pocoo.org/2011/12/22/implicit-scoping-in-coffeescript/ http://lucumr.pocoo.org/2011/12/22/implicit-scoping-in-coffe...
- snprbob86 14y agoI 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 https://news.ycombinator.com/item?id=3379962
- ataggart 14y agoBTW, ClojureScript has proper lexical scope.
- snprbob86 14y agoI'm not sure if you're telling me, or telling other folks in this thread, but for the record: I've fixed bugs in the ClojureScript compiler related to preserving the lexical scoping semantics :-) It's actually quite a tricky process and involves shadow tracking, symbol generation, self-calling function wrappers, and a bunch of other nonsense to deal with JavaScript's crummy semantics.
- batgaijin 14y agoUm... I believe JS does have proper lexical scoping. Could you source any evidence to the contrary?
- ricardobeat 14y agoDid 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.
- ben0x539 14y agoWith noscript, I get bad layout but working pagination. Maybe that'll work on mobile safari?
- sams99 14y agoour 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
- watmough 14y agoYour web-site also sat with the spinner running for 4+ seconds. You might want to try providing it in HTML format.
- manojlds 14y agoAnd I couldn't login using Google on Mobile Safari too.
- niggler 14y agoI would discuss how I feel about coffeescript and interstitial white space sensitivity and the ilk, but I'll point to a blog post which expresses most of my views neatly: http://blog.izs.me/post/10213512387/javascript-is-not-web-assembly http://blog.izs.me/post/10213512387/javascript-is-not-web-as...
- zalew 14y ago> 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 unindented ugly blocks in their non-indent-significant language then?
- Danieru 14y agoNo 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.
- shirkey 14y ago>Python's issue is that a non-fundamental aspect of programming has been paired with a fundamental aspect of programming. Python's "issue" is that it considers readability as a fundamental aspect of programming and that whitespace is critical to that end. Whether that suits a particular programmer is a matter of personal preference.
- rquantz 14y agoNo one is writing un-indented code. Oh I beg to differ. I've seen lots of terrible unindented or patchily-indented code. Especially in Wordpress plugins.
- camus 14y agoI 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/ 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.
- jtchang 14y agoAm 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?
- aroman 14y agoAre 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 :)
- cubicle67 14y agoEdit: 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.
- klibertp 14y agoYou're wrong. The 'property' is a method on the Function prototype - take a closer look. Anyway, style does matter and were this line written with readability in mind you wouldn't make this mistake. Also, I would definitely abstract over @get and property: makeProperty = (attrs...) -> func = () -> (@get(x) for x in attrs).join(" ") func.property(attrs...) MyApp.president = Ember.Object.create( fullName: makeProperty("firstName", "lastName") ) The parens after create are not needed, the next indented line should tell us that this is a function with arguments, but I don't mind them here.
- adamesque 14y agoIf 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-use-javascript-or-coffeescript/3153/19 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.
- jacquesc 14y agoSeems like a very narrow mindset. Why would they assume coffeescript won't adapt to ES6? CoffeeScript compiler can change quickly while maintaining backwards compatibility. ES6 standards move at a snails pace. There's other perfectly valid reasons to use pure-JS on a large open source project, but the ES6 thing is a red herring IMHO.
- idle_processor 14y agoName a couple of said valid reasons?
- nestlequ1k 14y ago1) Open source projects like this would tend to want as many possible contributors as possible. There's more people out there who are comfortable with plain JS than with CoffeeScript. 2) One may prefer a more explicit language, filled with semicolons, curly braces, and "function" functions. That said, I personally would have greatly preferred it as CoffeeScript, which I use regularly on projects where the people I work with have the same preference.
- cwp 14y agoWhat makes you think CoffeeScript can target ES6 while maintaining backwards compatibility? Did you read the discussion? Wycats makes a very good argument for the opposite position.
- itsbits 14y agogood..now i will look into Discourse...
- smnrchrds 14y agoHistory repeats itself. This topic reminds me of QWERTY vs. Dvorak. People continue using something because everyone else is and they always have; not because it's the optimal option.
- dsego 14y agoThere's no proof Dvorak is any better. http://www.reason.com/news/show/29944.html http://www.reason.com/news/show/29944.html
- subsection1h 14y agoWrong. "First, Dvorak is very good at keeping fingers on home row - 71% of keystrokes land there (compare this with 34% for QWERTY). This alone is worth the price of admission. Dvorak bottom row usage is very low at 9% (15% for QWERTY). Dvorak favours the right hand by 14% (QWERTY favours left by 15%). Dvorak has more uniform finger usage and makes greater use of the pinky (18% vs QWERTY's 10%). The cumulative run statistics illustrate Dvorak's strength in alternating hands. 62% of successive keystrokes on Dvorak do not use the same hand (rh(0)) and 88% of adjacent keystrokes use the same hand at most once (rh(1)). In contrast, with QWERTY only 51% of successive keystrokes do not use the same hand and only 76% use the same hand at most once. QWERTY forces the typist to use the same hand repeatedly, which limits the amount of rest and increases effort. Dvorak's preference for the use of the right-hand give it longer right hand runs with only 47% of keystrokes that use the right hand being followed by use of the left hand (61% for QWERTY). The corresponding statistic for the left hand is reversed, with Dvorak at 76% and QWERTY at 42%."[1] The authors of the Reason Magazine article from 1996 that you linked to stated that "Ergonomic studies also confirm that the advantages of Dvorak are either small or nonexistent." But the authors cited only one nameless, undated study. This promotion of QWERTY isn't surprising seeing as how Reason Magazine is written by ideologues whose goals include the promotion of the idea that the invisible hand of the market is never wrong. You should consider getting your information from specialists who are active researchers rather than the writings of non-specialists from previous decades. [1] http://mkweb.bcgsc.ca/carpalx/?dvorak http://mkweb.bcgsc.ca/carpalx/?dvorak
- raganwald 14y agoI find this a curious debate to have so early in Discourse's life. There doesn't appear to be a pain point, so it's mostly speculation. If this happens, then that consequence, but if this happens, then that other consequence... I would stick with CoffeeScript until it becomes painful. There is relatively little downside risk. If and when you have great people refusing to contribute code because they hate CoffeeScript, well, that'll be a pain point. On the other hand, what if you get a bunch of other people who like contributing code because they can do it in CoffeeScript? Are there meaningful statistics collected? Until there are, or at least a weighty collection of anecdotes, I'm sure there's something more important to worry about.
- laurent123456 14y agoFrom what I understand, the developers have noticed that they get patches for the Rail app but not much for the CoffeeScript part, so they think that by switching to JS they'll get more dev interested. Also it looks like one of the core dev doesn't like CS much, which might have precipitated things a bit [1]. [1] http://meta.discourse.org/t/is-it-better-for-discourse-to-use-javascript-or-coffeescript/3153/22 http://meta.discourse.org/t/is-it-better-for-discourse-to-us...
- bawllz 14y agoThere is a distinct possibility that the conversation was a chosen topic to try to get at the top of HN, so that we could all go and be consumed by the awesomeness that is Discourse without realizing we just got marketowned.
- calibraxis 14y agoDisclaimer: I don't know Discourse's situation in detail, and I use CoffeeScript on node.js, not the client. The sheer mass of anti-CoffeeScript FUD ironically makes it more likely that they'll get more contributions if they go back to JavaScript. ;) YOU might know people who seriously consider Erlang and Clojure, but most people respond badly to superficial syntactical differences. Of course, is "contributions" really the best metric? What about productivity or quality? And can they make it so that people can easily contribute JavaScript? (Even among people I know, I've heard such irrational FUD against CoffeeScript. And I know it's FUD because none of their boogiemen came true after I aggressively introduced it into their codebase. They now use it every day without concern. Most people hate innovation, including programmers.) In particular, the ES6 argument sounds like FUD. Did they link to timelines and CoffeeScript developers' opinions? And where's the tradeoff analysis comparing the immediate productivity benefits of CoffeeScript vs some future ES6 event?
- Herbert2 14y agoI've found that CoffeeScript is great at standardizing the various styles of coding JavaScript that exist in an office.
- benaiah 14y agoI supported the switch to JavaScript, despite being an avid Coffeescript developer. Why? Because any CoffeeScript developer worth their salt already knows JavaScript, and can translate the JS to CS and back quite simply (admittedly, it's not as nice as hand-written CS, and the compilation loses comments, but I still prefer it to writing the JS by hand if I'm doing a bunch). But many, many JS developers don't know CS, or don't like it. Now, this only affects the first official client. I imagine that there will be a CS port of the JS client as soon as the switch is made. That's the great thing about using a client to a REST API - you can have several different front-ends. If this was to be the only client, I'm not sure if I would support using JS over CS. (btw, I'm @benaiah on meta.discourse.org - I'm in the referenced thread)