News for hackers. Stuff that matters.
Re:“I hate almost all software” — Ryan Dahl by abi on Thursday September 29, 2011 @10:27PM (#3055309)
Your claim that JavaScript is "notoriously difficult to write quality software in" is unsubstantiated. Which language in your opinion makes it easy to write quality software in?
Re:“I hate almost all software” — Ryan Dahl by rbranson on Thursday September 29, 2011 @10:36PM (#3055348)
People only like JavaScript because they know it. Yes, it's more productive than Java because it's (barely) functional, but I personally believe the renewed love for JavaScript is mostly Stockholm Syndrome.
Re:“I hate almost all software” — Ryan Dahl by tom_b on Thursday September 29, 2011 @10:45PM (#3055374)
I wonder if JavaScript is mainly loved for its frameworks and libraries? Without jQuery, node.js, etc., how many people would be singing its praise?
Re:“I hate almost all software” — Ryan Dahl by Jach on Thursday September 29, 2011 @11:00PM (#3055407)
I believe since Java 6 (possibly 5), the JDK has come bundled with a minimal installation of Rhino which runs JS on the JVM. How many people actively use that? It's not hard to get going, 5 or less lines of code to start running a JS file and it will run everywhere with JRE >6.

But there's no jQuery, etc. It's a somewhat nicer way to work with Java since you aren't forced into I-don't-care-about-it-exception-catching hell and Map<Map<Map<...>>> madness, but compared to Jython or Clojure it doesn't match up. You can get a headless jQuery working with Rhino, though it's not as simple as it should be.

Re:“I hate almost all software” — Ryan Dahl by rbranson on Thursday September 29, 2011 @11:09PM (#3055440)
Rhino is really slow when compared to V8, like Ruby slow.
Re:“I hate almost all software” — Ryan Dahl by sjwright on Thursday September 29, 2011 @11:58PM (#3055607)
Rhino is slow, but it's freaking awesome if you need to write an algorithm that can run in the browser and on the server. Much much much nicer than having to maintain two implementations in two different languages.
Re:“I hate almost all software” — Ryan Dahl by mcantelon on Friday September 30, 2011 @12:54AM (#3055739)
Part of JS's popularity is definitely politics... the fact it's in the browser gives it a huge shot in the arm.

It's a decent language, though. Here's a comparison of JS to Ruby for some of the stuff people generally love Ruby for. JS comes out looking pretty decent.

http://fingernailsinoatmeal.com/post/292301859/metaprogrammi...

Re:“I hate almost all software” — Ryan Dahl by patrickc on Friday September 30, 2011 @12:08AM (#3055636)
To quote Douglas Crockford on JavaScript, "Lisp in C's Clothing"
Re:“I hate almost all software” — Ryan Dahl by rbranson on Friday September 30, 2011 @12:09AM (#3055638)
Before I learned a Lisp, I agreed with that statement. Now, I think nothing could be further from the truth.
Re:“I hate almost all software” — Ryan Dahl by GeneralMaximus on Friday September 30, 2011 @01:11AM (#3055765)
Indeed. Lisp is a simple language that can be completely defined in half a page. A naive implementation takes less than a thousand lines of code. The language is homoiconic, i.e, there's no difference between programs and data -- everything is a list. This enables programmers to perform complex transformations on code using macros. Lisp compilers such as SBCL generate code that is almost as fast as C++. Oh, and the original Lisp as described by McCarthy is strictly rooted in mathematics. If you limit yourself to writing only a subset of Common Lisp/Scheme -- one that emphasizes immutability and recursive functions on lists of symbols -- it is possible to use formal methods to prove the correctness of your code.

None of that is true for JS. I don't think Crockford thought his remark through.

Re:“I hate almost all software” — Ryan Dahl by asynchrony on Friday September 30, 2011 @02:46AM (#3055956)
As a lisp (Scheme and Clojure) user who nonetheless takes issue with this statement:

1. Modern (JS) runtimes have JITs that can generate code almost as fast as C++.

2. You can write purely functional code in JS.

3. JS has arguably less features than R5RS Scheme, which itself is hard to fit on half a page.

Re:“I hate almost all software” — Ryan Dahl by sausagefeet on Friday September 30, 2011 @10:00AM (#3057005)
What do you mean by point 2? Unless you don't plan on doing any I/O, you can't write purely functional code in JS. Not that you can in Lisp either...
Re:“I hate almost all software” — Ryan Dahl by asynchrony on Friday September 30, 2011 @03:31PM (#3058268)
I meant that there is nothing about JS that prohibits writing pure functions and reaping all the associated benefits (formal reasoning, etc.)
Re:“I hate almost all software” — Ryan Dahl by patrickc on Friday September 30, 2011 @12:48AM (#3055728)
If it ain't got macros, then it ain't a Lisp. Javascript is definitely no Lisp, but I really like that it allows function composition, which is somehow reminiscent of a Lisp. f(g(h(x))); instead of (f (g (h x)))
Re:“I hate almost all software” — Ryan Dahl by eurleif on Friday September 30, 2011 @12:54AM (#3055741)
Um, pretty much every C-derived language supports function composition, and uses that syntax for it. Am I missing something?
Re:“I hate almost all software” — Ryan Dahl by patrickc on Friday September 30, 2011 @01:32AM (#3055794)
You're right. I meant to say passing first-class functions as arguments, rather than pointers to functions as you would in C or an object method as you would in Java.
Re:“I hate almost all software” — Ryan Dahl by sausagefeet on Friday September 30, 2011 @09:59AM (#3057001)
I agree. I think this "JS is Lisp" nonsense is a pretty little platitude that many developers use simply because they don't know any better.
Re:“I hate almost all software” — Ryan Dahl by hnal943 on Friday September 30, 2011 @10:42AM (#3057172)
Crockford goes on to clarify that Javascript is really a combination of Java syntax, Self inheritance, and Scheme-like lexical scoping.
Re:“I hate almost all software” — Ryan Dahl by derefr on Thursday September 29, 2011 @10:33PM (#3055339)
By the definition given in the article (just solve the user's problem, don't build a tower of abstractions): Forth.
Re:“I hate almost all software” — Ryan Dahl by sausagefeet on Friday September 30, 2011 @09:56AM (#3056986)
JS is known for being a language with a lot of "WTFs" in it. Yes, you can write bad code in any languages and you can even write great code in JS. But to quote Fogus: "My problem with Javascript has always been that expertise is defined more in terms of understanding its faults rather than its features"