238 karma · joined June 30, 2010
I personally still wouldn't use node.js ever, but I see how it might be used by someone who already knows javascript and doesn't have the time to pick up Haskell or Erlang for some idea they want to execute.
Also, it used to be that without the HTML5 tech a lot of what you listed wasn't even possible and that was a forcing factor to use something else. So it's not just improvements in speed here, that RAGE demo wouldn't exist without WebGL.
EDIT: took out function hoisting stuff, it doesn't get hoisted after a quick check.
EDIT: Unless of course you get some non object value passed in and you want to be sure to keep it regardless of whether or not it is falsy. Not sure why you'd want to do that -- I am sure I would NOT like to see someone do that if I had to deal with their code.
Yeah I know, it's not a proper citation, I tried to find where exactly that was said at Google IO but found nothing so far. Either way, I didn't question it at the time I read it because given how dynamic JavaScript is I'd imagine there's only so much you can do to speed it up. Then again, this was coming from Google, and for all anyone knows the cause might just be them focusing more on Native Client instead of V8 for apps that need performance.
Am I reading this right? Objective-J (2008), C# (2001), HaXe (2005), etc having compilers to javascript in 1997?
Outside the browser you probably have a little more freedom, but it's not like you get to pick and chose in the style of "Oh, I'll execute this function in V8 since it does this faster, and that function in SpiderMonkey since it's faster there". For this reason, I don't think the fact Alioth only has measures for one engine would make a significant difference in the overall comparison. You'd be, for the most part, gaining performance in one place by sacrificing in another.
Anyway, in my personal experience, I've ran into performance problems in JS a lot more often than with C#. I also have to go through a lot more tedious practices to ensure my JS code runs as fast as it can, where as in C# Some.lookup.with.lots.of.dots.does.not.scare.me(). That's why your claim sort of surprised me. Then again, the last serious JS performance problem I had was 6 months ago (before FF4), so maybe a lot has happened in those 6 months.
By the way, I'm not too informed on how type inference is done in SpiderMonkey, so I may be completely wrong in mentioning this, but it sounds like they're trying to speed up a dynamic language by mimicking static typing. If that's how far they're going to improve performance, maybe soon enough JavaScript will in fact sit better in the Mono/.NET/JVM?
Since JavaScript will still invoke a function call even if the number of arguments don't match up, parameter defaults will not completely eliminate all the problems he lists.
function(a = 1, b = "Smith", option = {}) { .. }
Will still break upon trying to invoke it without parameter 'b' since param 'option' will just take its place while option will become an empty object.Furthermore he argues against "option = option || {};" only to do the same thing in the function header: "function(a, b, option = {}) { .. }"? What difference does that make?
The whole section in my opinion is negated by passing object literals to functions. Stuff like:
func({ a: 1, b: "Smith", option: { .. });
That makes it easy to read and easier to handle since names are agreed upon by both the caller and the function handling the invocation: var opt = config.option || {};
This is a common practice in JavaScript already, and it beats the solutions he wished were added to the language.http://shootout.alioth.debian.org/u32/benchmark.php?test=all... <- That still looks sort of far to me.
>> 3. Running dynamic languages on Mono is slow. Look at the speed of all the dynamic languages on Mono (or the JVM for that matter), and compare them to native implementations of dynamic languages, in particular JavaScript and Lua. The native implementations beat dynamic languages on Mono by a large margin, simply because .NET is a bytecode made for static languages.
It's not fair to compare JavaScript, which is already approaching a limit of how fast it can go, with the speed it gets running in Mono. Why? The two implementations have a vast difference of amount of energy and resources thrown at them; had Google, Mozilla, and Microsoft wanted JS to run fast on Mono, it would run fast on Mono.
Also saying that .NET is a bytecode made for static languages is kind of iffy now that the "Dynamic Language Runtime" is a part of .NET
As for formal logic being used in programming languages, while that is true, I am not sure that is what the author was referring to when mentioning "advanced mathematics". Maybe it was because he mentioned calculus early on and that somehow threw me off course, or maybe because I myself wouldn't look at it as something "advanced". Don't know, truthfully, I have no idea what he meant by "advanced mathematics", so I wont deny that it could have been formal logic.
Anyway, I see the point about DSLs and how they could be helpful to the common individual who doesn't want to devote so much of his or her life to mastering an all purpose language. I suppose that's great if you can actually accomplish everything you want that way, but in practice I feel like it would only get a person so far before they were out of options while still needing more. I always looked at DSLs as conveniences and extras to simplify the parts of the problem you don't care to fully concern yourself with. Beyond that scope though, it seems that an all purpose language is still going to be required for the non trivial aspects of coming to a solution, and to also glue all the trivial DSL components together. But hey, we should take any help we can get.
Got any proof of that?
The only language I ever used where I felt my knowledge of mathematics was inadequate was Haskell* . Other than that I don't see the reason why the author feels like programming languages require advanced mathematical concepts. In my opinion it's not the language itself, it's what you're using it for that may require math. And when that is the case, there's absolutely no way you can try and avoid it -- you have to understand how you're solving the problem in order to actually solve it, and this will have to be true regardless of what language you express your solution in.
Anyway, he mentions C a lot, and to me that language was more of an abstraction over how computers work as a machine rather than an abstraction over some mathematical concept of computation. Mind you, my only experience with C is reading K&R and fiddling around with pointers and memory allocation a few times, so by no means can I claim I actually know what I'm talking about. It's just to me it felt like I was concerned with getting some metal to do what I wanted instead of expressing something mathematical, and therefore, I can't follow this person's critique of the language.
* And even in the case of Haskell, a lack of knowing anything about Category Theory did not stop me from getting a basic idea of how and why Monads are so fundamental to the language. It does not stop me from being able to write something in Haskell, etc.
Makes me wonder if I should start my next JS project in CoffeeScript or ES.next.
I'm a fan of P/NaCl for this reason. Their approach goes directly at the problem instead of banging on a square peg for years and years until it barely manages to fit through a round hole. By the way, that is the only way I can describe using html/js/css for application development at this point. If it makes me sound bitter/angry, it's probably because I've been doing it for too long and grown tired of how tedious and limited it is.
tl;dr: you can't answer a question by saying the same exact thing that prompted the question to be asked in the first place -- this is therefore not a "response".
What personally amazes me is that people still use Gifs at all. Back in the day you'd see them as decorations on websites, but that role has been replaced by flash or using javascript for animations. Their only other advantage was transparency, but anyone who doesn't care for IE6 will just use a PNG instead since it offers superior alpha transparency.
Seriously, I don't see any reason to use Gifs these days and so see no reason why a replacement would even be desired.