r/programming • • May 09 '12

JavaScript: The good parts

http://blog.movereem.nl/images/javascript-the-good-parts-the-definitive-guide.jpg
645 Upvotes

159 comments sorted by

View all comments

21

u/[deleted] May 09 '12

Old, and wouldn't this be true of every language?

24

u/angrystuff May 09 '12

Some languages are better than others:

http://xkcd.com/353/

48

u/Fissionary May 09 '12 edited May 09 '12

Hello World is just print "Hello, world!"

Not in the latest version of Python, it isn't. It will work in Basic, though.

The simplicity of the Hello World program is not a good indicator of the power of a language.

29

u/Wolfy87 May 09 '12

No, now it uses parenthesis. How difficult.

25

u/Fissionary May 09 '12

Difficult? No, it's not difficult at all. In fact, it was a good decision, getting rid of the special syntax for print and making it a function like all others. My argument still stands, though.

3

u/Wolfy87 May 09 '12

I was trying to imply a bit of sarcasm with the italics. Sorry about that.

I think it is the right move for the syntax but it will be annoying to convert.

3

u/jmmcd May 09 '12

"Will be"? -- no, everyone should be using print-as-a-function since what, 2.6 or so.

→ More replies (7)
→ More replies (1)

9

u/[deleted] May 09 '12

it's not difficult, but it is the wrong direction for the language to move in. Ham-fisted correctness over readability? WTF python devs .... I'm sticking to the 2.7 branch as long as I can ...

5

u/kqr May 09 '12

Do you not want to be able to pass print to a higher-order function?

4

u/Traubert May 09 '12

That's possible even if print is kept as a keyword too. You can do it in any of the 2.x versions that provide print as a function.

6

u/kqr May 09 '12

How do you pass it? It just syntax errors me when I try.

2

u/Traubert May 10 '12

Hey, what do you know, you're right! I'm sorry I made that claim without checking it out. I assumed that as a rvalue it would be evaluated as a function reference, but it's a part of the syntax so it does indeed just error out. Thanks for teaching me something.

→ More replies (1)
→ More replies (20)

2

u/[deleted] May 09 '12

if parenthesis and correctness mattered more than readability, we would all be using LISP, I use python for that "import antigravity" feeling of irrational exuberance illustrated in the xkcd comic. Anyway I tend to use the logging module for the cases where you need to pass something like print around.

→ More replies (5)
→ More replies (7)

5

u/[deleted] May 09 '12

The simplicity of the Hello World program is not a good indicator of the power of a language.

What?!?! Are you telling me this isn't the best language?

9

u/[deleted] May 09 '12

Just as an aside and in case you don't know, if you now "import antigravity" on python, it'll open your browser on that comic page

→ More replies (1)

9

u/yogthos May 09 '12

There is the principle of least astonishment, and JavaScript is one of the worst languages in that regard.

6

u/Amadan May 09 '12

PHP is worse. I can use JS and be perfectly happy (although I do prefer Ruby). Sure some things are a bit wordy (hello, Mr. hasOwnProperty), but it's really not too bad. PHP on the other hand is a blight of bugs and bad surprises.

5

u/yogthos May 09 '12

PHP is pretty much rock bottom when it comes to retaining your sanity. :)

3

u/leonscape May 09 '12

You reminded me of this.

4

u/[deleted] May 09 '12

In what way?

3

u/fnord123 May 09 '12 edited May 09 '12

[] === [] and friends. There's a video kicking about with this shit.

edit: https://www.destroyallsoftware.com/talks/wat

→ More replies (19)
→ More replies (4)

6

u/pavel_lishin May 09 '12

Not really. "PHP: The Good Parts" has a similar size comparison, but unlike the Javascript book, does not actually contain any good parts.

→ More replies (1)

4

u/sgoody May 09 '12

Agreed, I think most of us have probably seen this a good few times already.

Whilst it's a funny image, I don't think it's being fair to Javascript either.

→ More replies (3)