6 ms·
Can't wait for this to happen and gain widespread browser support so I can actually use it. JavaScript is a beautiful language trapped in a lame syntax, pepper
by Swizec 15y ago
Can't wait for this to happen and gain widespread browser support so I can actually use it.
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.
- voidfiles 15y agoIf its that important you could just use Coffescript while you wait.
- Swizec 15y agoSomething about using a language that is essentially syntax sugar for a different language just doesn't sit right with me. 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 :)
- armandososa 15y agoBut then you have to wait for browser adoption. Maybe you'll safely be able to use this syntax in 4 or 5 years.
- TazeTSchnitzel 15y agoThere's other places where we see JavaScript. For example in node.js, where you could use this stuff in production immediately.
- njharman 15y agoAll languages above assembler are as syntax surgary as coffee script.
- chc 15y agoDon't be silly — assembler is just sugar for machine code.
- heretohelp 15y agoThat's not true at all, even something as low-level as C shifts the semantics dramatically away from how assembler works. 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.
- SideburnsOfDoom 15y agoThere are things about coffeescript that I just don't think are good ideas, like "unless" or "if" at the end. The person reading the code will think "Ok, now I'm doing x ... oh wait I'm not". the flow of it is just backwards. 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.
- jashkenas 15y ago> 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=desc&labels=change%2Cenhancement&page=25&sort=created&state=closed 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); }
- ralph 15y agoThe problem is we're mainly conditioned to expect the condition up front, notwithstanding Perl's initial slide down this slippery slope. Ugly syntax seems an argument for improving the syntax, not changing the grammar. if mum.birthday.isToday(): call(mum)
- SideburnsOfDoom 15y agoDoes a language need three ways to say "if x do y" ? or maybe there's an "unless !x do y" construct and it's 4 ways. 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.
- sausagefeet 15y agoPoor syntax and poor semantics. What is the missing part that makes it beautiful?
- tomjen3 15y agoIt is very widely deployed and will work on almost all client devices.
- oblique63 15y agoThat dosen't really say much about the language itself though, which I think was what was being called 'beautiful' (as opposed the ecosystem). 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'...
- calcnerd256 15y agoC's beauty is in its simplicity.
- tomjen3 15y agoC isn't really beautiful anymore but to somebody used to program in assembly it properly is beautiful.
- batista 15y agoNice expressivity, mostly functional, fun to use, etc.
- sausagefeet 15y agoIt has closures, I don't really know if it has anything else in common with a functional language...