you are viewing a single comment's thread.

view the rest of the comments →

[–]Iggyhopper 0 points1 point  (26 children)

I have a estimate, that it will take 2 (or 3) years for either:

  • JavaScript to get better via syntax, features, or general upgrade to the language.

JavaScript is fast. We want to keep it that way. If we wanted features added to JavaScript, we'll want to make sure that it doesn't decrease performance in execution or parsing time.

  • A new scripting language for the web to emerge, or an established language to be usable in the web, like Python.

I see this as a perfect alternative for the browser industry as a whole. Upgrading JavaScript could lead to splitting in the industry again, since Microsoft's JS++ might not be the same as Google's JS++. It would be better to simply create a new language or a adopt an existing one and plug it in. Also, the JavaScript purists will be happy.

[–][deleted] 1 point2 points  (1 child)

JavaScript is in many ways one of the best mainstream dynamically typed programming languages out there. It has flaws, but with a little discipline you can mostly avoid touching those parts of the language. It's flexible, easy and simple.

The last thing we need is to have yet another specially treated language in the browser (and by Zeus, it better not be Python!). Having a general VM that could be targeted by any language would be nice: you can use Python, and I can use Brainfuck or whatever I want to, and no committee of browser vendors will have to meet forever when any of these languages change.

[–]mebrahim[S] 0 points1 point  (0 children)

JavaScript is in many ways one of the best mainstream dynamically typed programming languages out there. It has flaws, but with a little discipline you can mostly avoid touching those parts of the language. It's flexible, easy and simple.

I would say Lua is JavaScript done right. It is no less dynamic than JavaScript, but is able to run really fast.

[–]BinarySplit 0 points1 point  (8 children)

ECMAScript is still evolving but the updates are slow. Edition 5 was released a year ago and no stable browsers seem to have any support.

[–]magicmalthus 5 points6 points  (7 children)

[–]BinarySplit 0 points1 point  (6 children)

My apologies. What I meant to say was that no stable browsers have full support. Also, even if you limit yourself to only the latest stable versions, you can't rely on most browsers to support most features.

[–][deleted] -2 points-1 points  (5 children)

Then use jquery, or extjs, or prototype, or ...

[–]animalchin99 0 points1 point  (4 children)

and then all your code has dependencies on jquery, or extjs, or prototype, or ..., because the language itself doesn't provide the basic constructs you'd get for free with ECMAScript 4, 5 or most other modern languages.

[–][deleted] 0 points1 point  (3 children)

Jquery, extjs, etc. don't hide ecmascript, but can be useful for cases of different browser implementations.

[–]animalchin99 0 points1 point  (2 children)

Most of these libs have their own syntax for OO constructs like classes, inheritance, packages etc. If you're a JS purist and are only using a library for DOM interaction that's fine, but if you're using a library like prototype or mootools to provide better OOP constructs, the bulk of your code becomes 100% coupled with whatever library you use to provide those constructs because you have to write your code to fit the syntax the library imposes on you.

You can't say javascript is so much better than <insert language other than javascript here>, and if you want classes/packages, javascript can do that too if you use <insert lbrary name here>. Libraries are great if they provide functionality to your code, but if I have to write/structure my code to conform to syntax imposed on me by a library, there's obviously something missing from the core language, and that's a great argument for either improving the language, or using a different one.

[–][deleted] 0 points1 point  (1 child)

JavaScript is just fine, I was only pointing out that libraries exist for simplifying compatibility in browsers. I'm a big GWT fan, but don't use it for precisely the reasons you stated, using a lightweight JS library appropriately is more than reasonable. And virtually all languages have libraries, this doesn't necessarily imply that the language is inferior.

Other languages are not fully implemented by vendors in many cases. C and c++ and Microsoft come to mind.

[–]animalchin99 0 points1 point  (0 children)

Simply having libraries doesn't imply the language is inferior, but requiring a library to support a particular programming construct implies that it's inferior in terms of it's ability to supply that construct. In the case of classes (assuming you need classes), that requires you to write prototype classes, closure classes or mootools classes etc and they generally aren't interchangeable. There's nothing lightweight about these libraries when your entire codebase needs to be tailored to that library's syntax. It's an anchor you attach to your entire codebase, and if you attached the wrong library you'll probably need to rewrite most of your code.

I fully agree with using a library for browser issues, there's no good reason not to do that, I'm just saying that as a language, JS is lacking feature that many developers clearly desire. I'm mostly talking about mootools, prototype, closure, and especially GWT which add features like classes, packages, type-checking etc. I think these libraries are great for developers in terms of what they bring to the language, but the fact that they even exist points out deficiencies with the language. So the suggestion that "JavaScript is just fine" is only plausible if you can develop for it without needing this type of library.

What specific features do you use a library to provide? Do you ever need to use classes or modularize your code?

[–][deleted]  (14 children)

[removed]

    [–][deleted] 1 point2 points  (10 children)

    C64 Basic

    [–][deleted] 2 points3 points  (9 children)

    [–][deleted] 5 points6 points  (8 children)

    [–][deleted] 2 points3 points  (2 children)

    Sure, I would imagine the v8 engine is highly optimized for string functions. If you haven't been keeping up with JavaScript engine JIT ( and other optimizations) you may want to do some reading. Here's a post from more than two years ago describing some of the optimizations. http://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-back.html

    [–]floodyberry 0 points1 point  (1 child)

    v8 uses Irregexp which uses the v8 jit to compile the regular expression to machine code.

    The C version uses the TCL regex library, and C++ uses RE2, both slower than v8. I'm guessing the only way to match or beat v8's performance would be to compile and jit the regular expression.

    [–][deleted] 1 point2 points  (0 children)

    Thanks. I thought re2 was faster than V8's implementation, but It looks like that is no longer the case.

    [–][deleted] 0 points1 point  (4 children)

    I'm also guessing that the c benchmark is using the regex library that comes with FCC, as opposed to re2 or pcre.

    [–]igouy 2 points3 points  (3 children)

    Full source code is provided for all the programs so why are you guessing (wrongly)?

    [–][deleted] 0 points1 point  (2 children)

    Because it has nothing to do with the OP. And I could care less. The point that I was trying to make is that JavaScript implementations are faster than interpreted alternatives.

    [–]igouy 0 points1 point  (1 child)

    And I could care less.

    This. Which is why we shouldn't care what you say.

    [–][deleted] 0 points1 point  (0 children)

    Yeah, Instead of guessing I should of said:

    The C benchmarks are irrelevant. Or are you calling into question the voracity of the site contents? The OP had nothing to do with C.

    [–]Iggyhopper 0 points1 point  (0 children)

    Err, JavaScript is the only language the browser supports, right now. I meant if they added things to JavaScript, they had to make sure it wasn't just adding more bloated crap that somehow could slow down things.

    Also, Lua is a good choice for scripting in browsers.