Live data from Hacker News

Why I'm Becomming a JavaScript Convert

benjamincoe.com

21–30 of 38 posts

Re: Why I'm Becomming a JavaScript Convert

#21
post #15

For all the positives of JavaScript, I still prefer Python. There are a lot of similarities, but I give Python higher marks in a few areas. The first one that jumps out immediately is the lack of requiring "var" in Python variable declarations. What I'd like to see instead I think is Python built-in to every major browser as a default language. And/or make it super easy for users to install runtime plugins for Python…

I bet as soon as you attempt to implement a DOM manipulation standard for Python you'd introduce all the same cross-browser incompatibilities as Java has. Also, in many ways Javascript is superior to Python. Closures are the only examples I know of off the top of my head.

Python has as much support for closures as javascript. The only significant feature in this respect that it is missing (that I am aware of) is multi-statement, in-expression lambdas.

Javascript's syntactic nicety is higher there, but on balance I think python's is far superior.

Both great languages, though.

Re: Why I'm Becomming a JavaScript Convert

#22
post #15

For all the positives of JavaScript, I still prefer Python. There are a lot of similarities, but I give Python higher marks in a few areas. The first one that jumps out immediately is the lack of requiring "var" in Python variable declarations. What I'd like to see instead I think is Python built-in to every major browser as a default language. And/or make it super easy for users to install runtime plugins for Python…

I bet as soon as you attempt to implement a DOM manipulation standard for Python you'd introduce all the same cross-browser incompatibilities as Java has. Also, in many ways Javascript is superior to Python. Closures are the only examples I know of off the top of my head.

Java != JavaScript

Re: Why I'm Becomming a JavaScript Convert

#23

For all the positives of JavaScript, I still prefer Python. There are a lot of similarities, but I give Python higher marks in a few areas. The first one that jumps out immediately is the lack of requiring "var" in Python variable declarations. What I'd like to see instead I think is Python built-in to every major browser as a default language. And/or make it super easy for users to install runtime plugins for Python…

Yeah, I don't get the recent Javascript love-fest when Python and Ruby (heck, even Perl) are tremendously superior. Mainly due to lacking insane design decisions like default global scope and having standard libraries that are actually useful. I mean, did it not occur to anyone that a language heavily used for processing user input might benefit from String.trim? And you'd think a language built on key-value pairs would come with a hashtable object.

Yes I'm probably ranting; I've spent a large portion of the last 12 hours writing a bunch of Javascript that I really shouldn't have had to.

Re: Why I'm Becomming a JavaScript Convert

#24

Earlier quoted context omitted.

JavaScript really doesn't seem appropriate for large software. Much of the features (like, for example, prototype inheritance) makes for small code but at the cost of some complexity. Even trying to ensure some measure of public/private data requires a lot of boilerplate code. Probably adding the necessary features to JavaScript to make it more appropriate for these tasks would ruin it for the things it's really very…

public/private is the most pointless distinction ever invented. Enforced privacy makes reuse nearly impossible. That said, I don't really think Javascript is all that special. Prototype OO sucks.

Can you explain why you think x sucks/is pointless?

Re: Why I'm Becomming a JavaScript Convert

#25
post #9

I use to hate Javascript. I attempted to build a large enterprise system using ExtJS... I ran into a number of problems. I then realized that I could accomplish the same task using GWT/GXT. It was successful. I still don't like Javascript, but I'm warming up to the idea of embracing it. It seems to me that with the advent of Node.js and document oriented databases that use JSON for their document description, such as…

JavaScript really doesn't seem appropriate for large software. Much of the features (like, for example, prototype inheritance) makes for small code but at the cost of some complexity. Even trying to ensure some measure of public/private data requires a lot of boilerplate code. Probably adding the necessary features to JavaScript to make it more appropriate for these tasks would ruin it for the things it's really very…

"Even trying to ensure some measure of public/private data requires a lot of boilerplate code."

Just use closures. Thats less code than you would have in many other languages.

Re: Why I'm Becomming a JavaScript Convert

#26

For all the positives of JavaScript, I still prefer Python. There are a lot of similarities, but I give Python higher marks in a few areas. The first one that jumps out immediately is the lack of requiring "var" in Python variable declarations. What I'd like to see instead I think is Python built-in to every major browser as a default language. And/or make it super easy for users to install runtime plugins for Python…

Yeah, I don't get the recent Javascript love-fest when Python and Ruby (heck, even Perl) are tremendously superior. Mainly due to lacking insane design decisions like default global scope and having standard libraries that are actually useful. I mean, did it not occur to anyone that a language heavily used for processing user input might benefit from String.trim? And you'd think a language built on key-value pairs wo…

Don't objects function as hashtables? var v = {"a": 1};

Re: Why I'm Becomming a JavaScript Convert

#27

For all the positives of JavaScript, I still prefer Python. There are a lot of similarities, but I give Python higher marks in a few areas. The first one that jumps out immediately is the lack of requiring "var" in Python variable declarations. What I'd like to see instead I think is Python built-in to every major browser as a default language. And/or make it super easy for users to install runtime plugins for Python…

python's variable scoping is useless.

i can't reassign a variable in an upper context. i can mutate the object it refers to, but i can't reassign the variable right there. instead it gets instantiated at the current level.

that's why javascript has "var". it has real lexical scoping.

IIRC python 3 has the "nonlocal" keyword to "fix" this mess, but i'm not pleased by that. i read the PEP and understand their reasoning. still, it's different behavior from what other languages do (notably scheme and js). they can't even make proper lambdas, but that's because they painted themselves into a corner with the syntax.

a freeform mode for python might solve the lambda issue... but then we'd have ruby or javascript, pretty much.

what tips the scales for me (i use python most) is libraries and environment. javascript doesn't yet have a real command line scripting experience. microsoft's windows scripting host and jscript come close, but all the library documentation is scattered throughout MSDN. i much prefer python's HTML documentation. it's terse and easy to browse.

Re: Why I'm Becomming a JavaScript Convert

#28
post #26

Earlier quoted context omitted.

Yeah, I don't get the recent Javascript love-fest when Python and Ruby (heck, even Perl) are tremendously superior. Mainly due to lacking insane design decisions like default global scope and having standard libraries that are actually useful. I mean, did it not occur to anyone that a language heavily used for processing user input might benefit from String.trim? And you'd think a language built on key-value pairs wo…

Don't objects function as hashtables? var v = {"a": 1};

I think the only real restriction is that you can't use arbitrary objects as keys - only strings or things that easily convert to strings (such as numbers).

See: http://ajaxian.com/archives/true-javascript-hash-table

Personally, I've never really regarded this as much of a problem.

Re: Why I'm Becomming a JavaScript Convert

#29
post #7

JavaScript has probably become my all time favorite programming language (beating Common Lisp and PostScript). I wonder if anyone has done an OS command line shell with JavaScript as the scripting language - having commands pipe JSON to each other could be rather cool.

Having commands pipe JSON to each other could be rather cool http://en.wikipedia.org/wiki/Windows_PowerShell

Yeah - I've used PowerShell a lot and while it is a nice idea I sort of find the overall experience less good than it should be.

For a bit I was doing a fair bit of PowerShell scripting and bash scripting at the same time and I ended up concluding that I still preferred the Unix command line. Using JSON as the "standard" data format would seem to me the ideal compromise between delimited lines of text (Unix shells) and full blown objects (PowerShell).

Re: Why I'm Becomming a JavaScript Convert

#30

Earlier quoted context omitted.

JavaScript really doesn't seem appropriate for large software. Much of the features (like, for example, prototype inheritance) makes for small code but at the cost of some complexity. Even trying to ensure some measure of public/private data requires a lot of boilerplate code. Probably adding the necessary features to JavaScript to make it more appropriate for these tasks would ruin it for the things it's really very…

"Even trying to ensure some measure of public/private data requires a lot of boilerplate code." Just use closures. Thats less code than you would have in many other languages.

What do you think that boilerplate code is made of? Closures of course. You simply can't make large scale software using just closures.
Post reply on HN