I guess, but less of a hybrid, if every single time I debugged Ruby I had to run GDB and constantly found myself reading C source I think it would be closer. If every time I wrote I line of Ruby I had to construct a mental model of the way MRI is going to translate the thing to C (for example because I need to know its going to wrap up my switch statements in a closure or what have you), we would be a more of a hybrid system.
Well, we have seen almost no contributions from the community wrt refactoring our js and we are a HUGE js app. In contrast we have seen massive amounts of refactoring around the Ruby side of things. Impossible for me to pin this on CS as I have no crystal ball, but it is a fact.
On a personal level I would be happy to never use CS again, I feel my hands are tied in weird ways and it encourages me to write stuff that I probably would never have written in the first place (like 4 levels of nested functions)
I prefer CoffeeScript, personally, its the only language I write in that I donāt think about the language.
However, Discourse is going to (hopefully) be around for a very long time. There are so many things that are going to be difficult for CoffeeScript in the future. For example, default arguments. null in CoffeeScript will defer to the default while in ES6 it will not because null !== undefined. I canāt see how it will target ES6 successfully and keep backwards compat.
Worth noting, CoffeeScript fell off the top 10 list on github. CoffeeScripters usually still like and write JavaScript, including the languageās creator. Discourse will get more contributors with JavaScript without question.
I prefer jS since itās better to write in JS since the it will take a bit of time for another contributor to convert the current āGetting Started Guideā or āTutorialā from Ember and another lib written in JS to coffeescript.
First, whitespace itself is not significant in CoffeeScript, any more than it is in Javascript (where it separates tokens, as in virtually every other language). Whitespace is not significant in Python either - indentation level is. See Python: Myths about Indentation. Coffeescript works the same way.
Second, significant indentation is not actually hard to parse. On the contrary, itās very simple - I refer you back to the above article. Essentially, the parser simply parses the difference in indentation as and tokens, modifying the level accordingly. While this might be slightly more difficult to parse than bracket-based blocks, it is hardly a āpain in the buttā to parse.
There are several things significant indentation does make harder:
Parsing with regexes. Which you should never do in the first place.
Mixing tabs and spaces. Which you should never do in the first place.
This is completely subjective (and I suspect itās probably not true).
ā¦ which is much easier than balancing brackets, because itās obvious at a glance. You already have to reindent when you write code in a bracket language. Now you just donāt have to balance the brackets.
This is the real reason Discourse should use Javascript. Donāt get me wrong - I do prefer Coffeescript, I just think Javascript is more appropriate for the official Discourse client.
I disagree that indentation-sensitivity is not a type of whitespace-sensitivity, but even if that applies to Python it does not apply to CoffeeScript. CoffeeScript is more whitespace-sensitive than Python. Compare:
jQuery ($) -> bar
jQuery(function($) {
return bar;
});
with:
jQuery($) -> bar
jQuery($)(function() {
return bar;
});
It also doesnāt enforce consistent indentation in the same way as Python, allowing for silly cases like this:
[
1
->
2
->
3
->
4
->
5
->
6
]
Instead of causing a compile error, the mis-aligned -> alters how the indentation of subsequent lines is interpreted.
I followed the CoffeeScript project on GitHub for a while, and my impression is that there are tons of edge cases in the compiler whose behaviour is poorly defined, varies between versions and may be difficult to replicate without a direct port. Part of the goal of the CoffeeScript 2.0 project was to define the grammar more rigorously, but I donāt know the status of that project.
I concur with this if for no other reason than I use OTBS and the indentation is far more important to me than the closing brace. The closing brace is at best a handy visual aid to ensure Iām at the end of the intended logic branch, but only because braces are required.
On the flip side, braces allow me to use inline stubs for things like encapsulating API methods or throwing exceptions where code has not yet been implemented.
Perhaps Iām unique, it certainly seems so from reading the posts above, however Iād like to add that Iām much less likely to contribute to a project written in javascript than in coffeescript, and I also happen to be someone with the exact skillset necessary to contribute (rails/ember/coffee).
Does it come down to taste? I guess that ultimately it does, however I find that after working with coffeescript for so long writing, pure js just feels incredibly annoying, slow and unwieldy.
It certainly seems like Iām in the minority, however I donāt find that to be unusual when talking about coffeescript!
What if you would convert each module/script to vanilla as itās modified? This would gradually convert everything over to JS as time permits. A solid style guide would be a must though!
I find that you can tab-trigger your way out of the āvanillaā JS is more typing problem. You can have presets setup for almost everythingā¦ methods, functions, anon callbacks, AMD modules, etcā¦
One advantage that CS has is that itās more readable if you work with CS a lot. However, I found it hard to parse blocks when I first started writing it ( I mainly use it for tests currently).
From a personal perspective, the only reason I would contribute to discourse is because the client base is coffee script. JavaScriptā¦ All the amazing innovations in techā¦ JavaScript? Kids donāt like it, and Iād put 50 bucks that JavaScript is the mainframe tech stack of the next generation(to be replaced). 5 years from now your coffee script can be compiled into JavaScriptās replacement. Discourse is awesome BECAUSE coffescript was used and enables creativity to trump syntax. Switching to JS might just send you āoff courseā.
I would hope you would like to contribute to the project because you believe in the mission, like the software and want to evolve and improve online Discourse, not purely because we chose js or cs.
5 years from now your coffee script can be compiled into JavaScriptās
replacement.
Javascript has been running in browsers for 18 years. Itās been adopted by every browser on every platform.
Itās possible that in 5 years, an alternative language will be supported by some browsers (and that would be nice). But itās near-certain that Javascript will still be supported by all browsers. It has too much inertia to disappear that fast.
I agree with you on your point. To clarify: Itās not that I would only contribute to CS projects, it is that Iām not a JavaScript guru (Iām more of a devops/data warehouse/automation creature). I see CS as a tool that enables others to create clean & functional JS, is easier to read (opinion), and would provide an easier entry for me as a contributor.
Though come to think of it, it seems there are other barriers to contributing to open source other than the language itself. Contribution processes, Git pull requests, anxiety around being publicly chastised for janky pull requests, etc.
How about streamlining the contribution process? Seems like there could be an opportunity here for some interesting open source development as wellā¦ a āGitHubā like service that manages contributions, integrates with github(others), and makes the contribution process more welcoming for developers who may be coming from varied backgrounds.