7 ms·
I'm one of those who think Javascript is a good programming language (or at least I'd prefer it to any functional language). Javascript is basically Scheme/Sel
by nl 13y ago
I'm one of those who think Javascript is a good programming language (or at least I'd prefer it to any functional language).
Javascript is basically Scheme/Self with a C-based syntax[1][2], and both Scheme and Self are well regarded.
It has a bad reputation because of the terrible code people write using it in web browsers, but as languages go, it's pretty nice.
Browser/DOM APIs OTOH are historically pretty awful.
I suspect many of those who think it is terrible do so based n language snobbery, or they cannot separate the language from what it has been used for.
I may well be wrong, though - what actually makes it a bad language in your opinion?
[1] http://en.wikipedia.org/wiki/JavaScript http://en.wikipedia.org/wiki/JavaScript
[2] http://www.ecmascript.org/es4/spec/overview.pdf http://www.ecmascript.org/es4/spec/overview.pdf
- laichzeit0 13y agoI think the problem is that the syntax looks too much like C and most people assumed they already "knew" Javascript without bothering to learn it from scratch. "Javascript - The Good Parts" should be mandatory reading before touching the language. At the same time it's a double edged sword - because it looked so similar to C, it most likely was so successful. I'm talking historically as someone who was the typical C / Perl programmer back in the 90s when the web took off and made this exact mistake.
- Derbasti 13y agoThat meme "Javascript is basically Scheme with a C based syntax" has been refuted so many times it's not even funny. Does it have a metacircular evaluator? Is it homoiconic? Does it have macros? Seriously, read SICP or some other Lisp book. You have no idea what you are talking about.
- TheZenPsycho 13y agoAnd yet you haven't cited even one refutation. Javascript has first class functions. It has closures. it has nice object/literal syntax. If you don't consider it cheating to use a library, it does have macros if you use sweet.js. It has a metacircular evaluator, from the very beginning called "narcissus", and if it had homoiconicity, it would be even more direly hated than it is now. Having syntax, for better or worse, is a strength that means that people actually use the language. For reals. Not just that one time at college. The real question is how are any of those features actually useful from anywhere but a theoretical purity standpoint? We're not exactly writing AI systems here. At the end of the day the language is there to write programs. And the sophistication of the programs you need to write in javascript doesn't really need those things most of the time.
- Derbasti 13y agoProbably one of the best written ones: http://journal.stuffwithstuff.com/2013/07/18/javascript-isnt-scheme/ http://journal.stuffwithstuff.com/2013/07/18/javascript-isnt... But basically, ask anyone with Lisp experience. Only JavaScript people without Lisp experience argue that JavaScript is Lispy.
- TheZenPsycho 13y agoThat's one. Not "so many it's not even funny". From the sound of it, you should have been able to rattle off 5 without hesitating. Maybe you meant "one. There's exactly one refutation" as for your second remark, uh... Douglas Crockford?
- Shamanmuni 13y agoDouglas Crockford just said that even though Javascript's syntax resembles an imperative language like C or Java, it's much more similar to a functional language like Lisp or Scheme. From that comment a whole myth began which states that Javascript == Scheme. That's like saying Java == C just because both are imperative. Handwavy and completely wrong. What you should take from that assertion is "Javascript is more functional than imperative" (which is correct) and not "Javascript is lispy" (which is not).
- draegtun 13y agoMark Jason Dominus also says the same thing about Perl in his Higher Order Perl book [1][2] and goes onto show that Perl has 6 of the 7 features that Norvig describes has making Lisp different [3]. [1] http://hop.perl.plover.com http://hop.perl.plover.com [2] Perl is much more like Lisp than it is like C (from Preface) [3] ... the book "Paradigms of Artificial Intelligence Programming", by Peter Norvig, includes a section titled "What Makes Lisp Different?" that describes seven features of Lisp. Perl shares six of these features; C shares none of them. These are big, important features, features like first-class functions, dynamic access to the symbol table, and automatic storage management. (also from Preface)
- nl 13y agoTake it up with Brendan Eich: Remember, I was recruited to "do Scheme", which felt like bait and switch in light of the Java deal brewing by the time I joined Netscape. My interest in languages such as Self informed a subversive agenda re: the dumbed down mission to make "Java's kid brother", to have objects without classes. Likewise with first-class functions, which were inspired by Scheme but quite different in JS, especially JS 1.0.[1] I presume you saw the word basically in my post? There's no doubt it is simplified, but that's a strength as well as a weakness. But anyway: A metascircle evaluator: https://github.com/mozilla/narcissus https://github.com/mozilla/narcissus It's not Homoiconic, and nor does it have macros - but a number of the languages the OP named as "good" languages lack both these features too. I stand by my point: Javascript is a perfectly good language. [1] https://news.ycombinator.com/item?id=2786720 https://news.ycombinator.com/item?id=2786720
- camus 13y agono it is not. half the people that are using it do so because it is shiped in browsers ,the other half are server side masochists that are not smart enough for Scala or Closure ...
- nl 13y agoSo that would be the language snobbery argument I mentioned previously? You make it sound like you think having to be smart to use a language is a good thing.
- camus 13y agoYeah , it has a little bit of functional features , but it would be like saying PHP is a functional language because it has closures and first class functions. When the rest is broken , ( bad design , no concept of expressions like Ruby or Scala ) . It doesnt make the language magically good. Javascript is not a choice for many web-devs and for all front-end devs, that's basically the only thing you can use in a browser. And even if one uses a transpiler, 3rd party scripts are still in JS. That's why the hate. Otherwise people would not give a damn about wether it is good or bad. When one is used to something better (like Scala), one doesnt want to spend its time in this poor ecosystem. DOM apis are quite good ,that's the only reason why most people are using JS today. They are just still inconsistent between browsers.
- aaronem 13y agoWhat on God's green earth gave you the idea that PHP has either closures or first-class functions? PHP, in its current version, has a Closure class whose name is an outright lie, and which, along with some really nasty syntactic sugar, constitute the basis for PHP's equally dishonest claim to have finally gained first-class functions. It's not just that the rest is broken -- it's not even just that this stuff is broken too; it's that the people responsible for it either don't mind lying about it, or they genuinely believe they're telling the truth. I'm not actually sure which prospect disgusts me more.
- cbsmith 13y ago> Javascript is basically Scheme/Self with a C-based syntax[1][2], You forgot to mention "and without a native way to read and write bytes", which is one of just a few highly relevant examples of why it might not qualify as "a good programming language" for the job. (Others might include having a probabilistic parser...)
- TheZenPsycho 13y agoYour information is out of date. It does. Have a look at "typed arrays"
- cbsmith 13y ago"Typed arrays are available in WebKit as well. Chrome 7 includes support for ArrayBuffer, Float32Array, Int16Array, and Uint8Array. Chrome 9 and Firefox 15 add support for DataView objects. Internet Explorer 10 supports all types except Uint8ClampedArray and ArrayBuffer.prototype.slice." Oh, and look here: http://www.khronos.org/registry/typedarray/specs/latest/ http://www.khronos.org/registry/typedarray/specs/latest/ We have an "editor's draft", updated on July 2013, littered with "non-normative" sections, and not on the ECMA site. You can check out the language standard itself and searching for "typed arrays" there: http://www.ecma-international.org/publications/standards/Ecma-262.htm http://www.ecma-international.org/publications/standards/Ecm... So yeah... not standard.
- TheZenPsycho 13y agoThey are in ES6 which will be standard any year now. If that's not good enough for you then I guess there's nothing stopping you from just writing anything you need in 6502 assembler.
- cbsmith 13y agoHow long do you think the list is of languages that didn't wait until revision 6 before adding support for working with bytes? or are you seriously trying to suggest that it has to either be JavaScript or 6502 assembler?! Do you think it is maybe possible that a language that had standard ways of working with bytes say within the first decade of popularizing it just might be better suited for talking to hardware?
- asdasf 13y ago>Javascript is basically Scheme/Self with a C-based syntax[1][2] That is an absolutely absurd claim. Javascript shares similarities to smalltalk, perhaps you confused it with scheme?