Why is javascript the only client side scripting language implemented in browsers?

27,848

Solution 1

Well, Google is trying to buck that trend with Dart. The community hasn't been entirely receptive to the idea; either.

Google proposed adding multiple VM support for Webkit which didn't go down very well.

One particular comment summed it up nicely as to why there has been some resistance to that:

In this case the feature is exposing additional programming languages to the web, something without any real benefit to anyone other than fans of the current "most awesome" language (not too long ago that might have been Go, a year or so ago this would have been ruby, before than python, i recall i brief surge in haskell popularity not that long ago as well, Lua has been on the verges for a long time, in this case it's Dart -- who's to say there won't be a completely different language in vogue in 6 months?), but as a cost it fragments the web and adds a substantial additional maintenance burden -- just maintaining the v8 and jsc bindings isn't trivial and they're for the same language.

The issue here isn't "can we make multiple vms live in webkit" it's "can we expose multiple languages to the web", to the former i say obviously as we already do, to the latter I say that we don't want to.

Unless we want to turn webkit into the engine that everyone hates because of all its unique "features" that break the open web, a la certain browsers in the late 90s.

CoffeeScript is another example of an emerging client-side scripting language. However, rather than support another virtual machine in a browser (as Google is trying to do with Dart), it compiles to JavaScript. There are several other "compile X to JavaScript" that do that as well. emscripten is a good example of compiling LLVM to JavaScript.

So there are plenty of other client languages; they just all use JavaScript as an intermediate. I'd argue that should be what Dart does as well, though they have some room to improve.

Solution 2

Internet Explorer supports any Windows Script Engine, so you can make it support any language that has been implemented as one, or write your own.

Share:
27,848
Anand
Author by

Anand

Updated on July 05, 2022

Comments

  • Anand
    Anand almost 2 years

    Why don't browsers add support for, say, Python scripting as an alternative to Javascript? Or more general purpose scripting languages? Is there a reason that Javascript is the only one implemented across browsers? After all, the script tag does have support to specify the scripting language used.

    (I know there is VBScript support in IE, but it seems obsolete for all intents and purposes.)

  • Evi1M4chine
    Evi1M4chine about 11 years
    That is not an argument, but a logical fallacy. Basically, you’re saying “X, because X”. Simple circular reasoning, and hence invalid. Also, it’s a classical “appeal to the majority” fallacy.
  • flow
    flow about 11 years
    speaking of logic, correct your comment is, but speaking of reality and markets, correct it is not.
  • Milind R
    Milind R over 9 years
    So supporting more languages is considered as being against the "open" web... The irony!
  • PedroD
    PedroD almost 9 years
    the problem is that browsers would need to implement a new interpreter for each new language, unless...
  • skywalker
    skywalker almost 8 years
    "any real benefit to anyone other than fans of the current "most awesome" language (not too long ago that might have been Go, a year or so ago this would have been ruby, before than python, i recall i brief surge in haskell..." - So these languages are old and javascript is the most modern language!!! Javascript is, was and will be the most awesome language which everybody will happily use in the next 100000 years!!! Super!!! We love javascript because the mayor browsers support it!!!
  • Marcelo Lacerda
    Marcelo Lacerda almost 7 years
    I think that a better direction would be to split the javascript engine into two parts: A language compiler for each language, javascript, python, dart or whatever that turns code into ASM.js (provided by language creators) and an ASM.js interpreter, provided by the browser. This way there wouldn't be a significantly bigger burden on browsers and the choice of client-side languages would be bigger.
  • Nader Ghanbari
    Nader Ghanbari over 6 years
    If it sounds logical and reasonable to you why not being supportive instead of admitting that markets are illogical and reality sucks, maybe they do but I'd like to hope that we can fix things.
  • Nader Ghanbari
    Nader Ghanbari over 6 years
    Browser industry (and consequently Javascript) resemble oil industry! Both try hard to hide a better and safer world from people by selling them big lies. We're all oil-addicted without knowing that there has been greener alternatives since decades ago. Same goes here, a poorly designed language is still the only reliably supported one by all major browsers. That's why humanity makes progress at such a slow rate. We're afraid of change!
  • nimdil
    nimdil about 6 years
    Wouldn't it make sense to build in VM for s.t. similar to Java bytecode or CIL and compile all langages - including JS - into it instead of running JS directly?
  • Alan B
    Alan B over 5 years
    "something without any real benefit to anyone" - other than everyone who loathes bloody Javascript.
  • Lime
    Lime over 3 years
  • ShifraSec
    ShifraSec almost 3 years
    I think it's more of a security problem as well exposing different languages
  • Endless
    Endless over 2 years
    elm, purescript, dart, coffeescript, typescript, clojureScript... it all comes and then goes. this summary is the only reason to why i stick to coding things in javascript, no other language will ever be supported. I like typing but i *** hate the typescript syntax, lets go i ♥️ vanilla javascript! (and jsdoc)