JavaScript is a beautiful language trapped in a lame syntax, peppered with poor semantic choices based on what was considered "just the way it is" back then.
JavaScript is a beautiful language trapped in a lame syntax, peppered with poor semantic choices based on what was considered "just the way it is" back then.
I'd much rather they fixed javascript, than use coffeescript.
Although this might be unfair to coffeescript, I haven't given it a proper try-out yet :)
C functions conceptually in a half-assed attempt at making the computer behave marginally more like a Harvard Machine than a Von Neumann one.
OTOH, coroutines are easier to bring about in assembler than in C.
The "myFunction(item) for item in array" syntax also seems wrong way around. You use "item" before you say what it is.
I'm not an expert. These are just initial impressions, but coffeescript seems to have some good ideas, but tries to do too much. It would be interesting to see what thought process went into deciding to include certain constructs. Was it just an experiment? Are there reasons that might persuade me?
Ultimately the better JavaScript is also going to be JavaScript.
> It would be interesting to see what thought process
> went into deciding to include certain constructs.
Happy to oblige. There's plenty of reading material and conversations about most language decisions available here:https://github.com/jashkenas/coffee-script/issues?direction=...
As to the existence of (optional) postfix "unless" and "if" -- does it also sound backwards to you when someone says:
"Call your mother if it's her birthday."
... in English? If that doesn't sound so crazy, then consider the CoffeeScript: call mom if mom.birthday.isToday()
It's a little thing, that hopefully you can take advantage of to make short conditionals more readable then the JSLint-style JavaScript: if (mom.birthday.isToday()) { call(mom); } if mum.birthday.isToday(): call(mum)This to me looks like going out of your way to have lots of ways to do the same thing. I never cared for it in PERL either.
The argument that "it reads like English" is not one that I like much - The history of making programming languages read like English is a long succession of dead ends. Programming languages work more like formal maths proofs than they do like English prose. Rather make the language readable on its own terms.
There certainly have been notable failures, such as Applescript, but I find it hard to dismiss Coffeescript, Ruby, SQL and FORTRAN which have all been quite popular.
You left out a notable example of Cobol - Which would you rather read: "Add 1 to someValue Giving someValue", or "someValue++" ?
Hell, it's very similar to how "map" works in most functional languages -> "map function items"
"myFunction(item) for item in array" looks like "call myFunction on "item", which is not yet defined... oh now it is." It's backwards.
Besides, couldn't the same argument be made about C? Sure I know a lot of people 'like' C, but I don't think I've ever heard of it being referred to as 'beautiful'...