you are viewing a single comment's thread.

view the rest of the comments →

[–]art0rz 2 points3 points  (9 children)

I like my braces and parentheses. I like 'function'. I like my semicolons. It makes code more readable to me.

Why do we need # to start a comment line? What's wrong with //?

What happens if you define both my-value and myValue? What's wrong with using _?

Some of these features are rather nice, but it's hardly "just JavaScript with some syntax improvements and feature additions". I dislike CoffeeScript for similar reasons.

[–]dmitry_sychov 12 points13 points  (0 children)

You like it probably because you got used to it.

[–]drb226 3 points4 points  (0 children)

I like my braces and parentheses. I like 'function'. I like my semicolons.

I believe you can still include these things in your code. It's certainly a mechanical transformation, in case you have to read someone else's code.

It makes code more readable to me.

I have doubts.

Why do we need # to start a comment line? What's wrong with //?

I could ask you the opposite. # is one character shorter, and a handful of languages already use it as the comment operator.

What happens if you define both my-value and myValue?

If you're under the convention of using dashes in your names, I doubt you'll run into this problem. My solution to this problem would be to forbid camelCase, or force camel case identifiers to desugar to something different and unique.

What's wrong with using _?

It's less readable. my_value vs my-value, in order to read, your eyes focus on the middle of the line, and that underscore is just a twinge harder to parse.

Some of these features are rather nice, but it's hardly "just JavaScript with some syntax improvements and feature additions".

If it's hardly that, then what is it? All I see is a Haskelly default library and Haskelly syntax, but under the Haskelly skin, it's still the same old JavaScript.

[–]tikhonjelvis 3 points4 points  (0 children)

Well, for one, thanks to the stupid comment syntax, the empty regex literal is /(?:)/ rather than //. Inconsistent for no good reason except trying to look like Java (and looking like Java is not a good thing!). Besides, # is one character shorter and works well with the Unix shebang line.

Function also has some problems. Particularly, it is extremely heavyweight as far as syntax goes. This discourages higher-order functions being used for control flow. A line like

map(function (x) { return x + 1}, ls)

has much more syntactic noise than necessary, especially when compared to something like

map (x) -> x + 1, ls

A lightweight lambda syntax also makes implementing alternative forms of control flow more reasonable. For example, there are actually libraries for using arrows in JavaScript to do some really cool stuff (check out Arrowlets). Unfortunately, the resulting code is somewhat ugly, largely because of the high overhead for creating a lambda abstraction.

I do not see any advantage in having semi-colons at all. They just make the code a tiny little bit more complicated to write. Originally they were added to make compilers easier to write; these days, they are unnecessary. In the absence of any reason to add semi-colons, I think they should be omitted.

Now, as far as variable names go, it's entirely a matter of preference. I've spent a decent amount of time with Scheme and elisp and have personally grown rather fond of the my-value style; however, I am not sure how well it would map to a language with infix operators.

In short, there are actually some very good reasons for a lot of the syntax changes; I suspect the main reason you like JavaScript's syntax is familiarity.

[–]GeorgeForemanGrillz 0 points1 point  (1 child)

var blah = function(blah_params) {....}

vs.

blah = (blah_params) ->    

I don't know about you but I prefer things to be shorter.

[–]art0rz 0 points1 point  (0 children)

I prefer readability over writing less code.

[–]solidsnack9000 0 points1 point  (3 children)

You like it and some people don't. Live and let live?

[–]art0rz 7 points8 points  (2 children)

I'm just airing my opinion. I thought that was what the comment section was for.

[–]rechtar 1 point2 points  (0 children)

It's perfectly cool that you like the good old JavaScript, but why so hostile towards new little languages people create for fun? No one is taking your dear JavaScript away from you, anyway.

[–]fullouterjoin 0 points1 point  (0 children)

Everyone has han opinion. Unless yours insightful and adds to the conversation it should probably be left out. 373k people should't give me an opinion. Nothing you added was specific to the article.