[HN Gopher] Ask HN: Why didn't the early web support more client...
       ___________________________________________________________________
        
       Ask HN: Why didn't the early web support more client side
       languages?
        
       Disclaimer: I'm a backender so I may have this all wrong :)  The
       script element in HTML has provided the language property since its
       introduction, though nowadays it is deprecated in favour of the
       type attribute.  But the browser-supported languages seems to have
       been almost entirely Javascript and VBScript.  Given that
       Javascript is considered to be an _at best_ quirky [0] language
       (justifiably given its 10 day gestation) how come the browser
       ecosystem never expanded to accommodate more direct scripting
       languages - particularly in the early days when Javascript
       libraries were rare beasts? As I remember it Javascript was deeply
       unpopular with devs until libraries like JQuery came along to make
       things a little less painful.  Was it the baleful influence of IE6
       or some other winner-takes-all effect or what?  [0]
       https://www.goodreads.com/book/show/2998152-javascript
        
       Author : dcminter
       Score  : 10 points
       Date   : 2021-07-30 14:50 UTC (8 hours ago)
        
       | notquitehuman wrote:
       | JavaScript, as I recall, was the answer to Java being crashy and
       | slow on 50 MHz processors. Microsoft tried to make VBscript
       | happen, but was very Microsofty with the licensing, so JavaScript
       | won by default. It's been good enough to prevent people from
       | successfully replacing it, but annoying enough that people keep
       | trying.
        
         | eqvinox wrote:
         | > JavaScript, as I recall, was the answer to Java being crashy
         | and slow on 50 MHz processors.
         | 
         | [citation needed]
         | 
         | Having lived through that period of time, I do not recall Java
         | applets and JavaScript ever being considered to be in the same
         | category / trying to solve similar problems.
        
         | mileza wrote:
         | Historical records seem to contradict themselves on this
         | matter. What I recall reading was that they were created for
         | two different things: JavaScript was created to add basic
         | interactivity on the page, and Java was intended to be used for
         | more CPU-intensive work.
        
       | softwaredoug wrote:
       | Flash and Java applets were a big thing, these ARE client side
       | languages. But to work well the vendor had to install a runtime
       | on your PC. Back in the day JavaScript/HTML was too slow and
       | inconsistent for intensive client side work. So people that
       | wanted into intense client side apps used these runtimes.
       | 
       | Cross platform support across many vendors has always been hard.
       | Look at cross platform libraries in C. Different compilers, OS,
       | and std library implementations. Python or Ruby on the other hand
       | have one "vendor" that works to make the runtime consistent on
       | different platforms.
       | 
       | So for something like Python or Ruby to work well, it'd need to
       | either be:
       | 
       | 1. A central vendor driving development, who would need to manage
       | and install a runtime on your computer
       | 
       | Or
       | 
       | 2. All browser vendors have to buy into a single spec and make a
       | very consistent implementation across their browsers.
       | 
       | Or
       | 
       | 3. Compile to JavaScript (or web asm etc)
       | 
       | For (2) browser vendors already invest heavily in JavaScript and
       | have a hard time keeping up! For (1) I'm not sure why any
       | language vendor cares to try to compete with JavaScript
       | seriously. The browser is quite different environment than the
       | CLI or Desktop that it'd be a significant investment without
       | clear upside.
       | 
       | We do see (3) with Typescript and Coffeescript. These create some
       | debugging friction. Also as JavaScript gets marginally better the
       | appeal of these other languages can feel more niche, and many
       | people just use the common denominator.
        
         | brundolf wrote:
         | > We do see (3) with Typescript and Coffeescript
         | 
         | And ClojureScript, and PureScript, and Elm, etc
         | 
         | Honestly, in my hobbyist experience, JavaScript is a joy to use
         | as a compilation target. All the flexibility and the laundry
         | list of features which can make it a handful to use directly,
         | make it a wonderful base for nearly any kind of language you
         | can imagine. And because it's higher-level, you can focus your
         | energy on your own language instead of on re-implementing the
         | fundamentals from scratch. And then of course it performs
         | better than most similarly-flexible languages, and runs
         | _anywhere_.
        
         | dcminter wrote:
         | All fair points, but still, don't you think it's a little
         | surprising that browsers never supported perl client side? That
         | seems like the obvious one to me given all the cgi scripting
         | written in it.
        
           | eqvinox wrote:
           | > surprising that browsers never supported perl client side?
           | 
           | They did, actually:
           | 
           | https://perlhelp.web.cern.ch/Components/Windows/PerlScript.h.
           | ..
           | 
           | If you installed ActivePerl, you could use, in IE 5.0,
           | <script language=perlscript>...</script>
           | 
           | I even remember using this for shits and giggles. And then I
           | noticed noone else was willing to install it, and gave up on
           | it.
           | 
           | (Don't get confused by the server-side bits, those are for
           | IIS, this stuff did both server-side and client-side...)
           | 
           | [Ed.add.: also I don't think Netscape ever supported anything
           | other than JavaScript, but I'm not sure of that.]
        
             | dcminter wrote:
             | Nice! I had no idea that existed!
        
       | PaulHoule wrote:
       | More languages more problems?
       | 
       | In a desktop environment you can have many languages that compile
       | to the same machine code. You can compile interpreters that run
       | in that machine code.
       | 
       | If browsers had to support ten languages then they would be ten
       | times as complicated. You'd not just have quriks and bugs in
       | Javascript but quirks and bugs in the other languages to worry
       | about.
       | 
       | Today with WebAssembly you could compile any language you want
       | for one runtime, though people have done that with transcoding to
       | Javascript for a long long time.
        
         | dcminter wrote:
         | Maybe? But there was enough demand for other
         | languages/capabilities that the Java and Flash plugins existed.
         | 
         | At the peak of the browser wars I'd have expected this to be
         | something tried to get mindshare (or maybe it _was_ and didn 't
         | work well enough that I ever heard about it?)
         | 
         | Edit: E.g. HTML 4 spec (at least) offers text/tcl as a
         | plausible language value. Did anyone ever offer that? _Surely_
         | someone must have supported text /lisp as well at least briefly
         | :)
        
           | danudey wrote:
           | If anything would support text/lisp, it would be the browser
           | built into emacs that my coworker keeps pointing out VIM
           | doesn't have.
        
             | dcminter wrote:
             | I congratulate you; if you cannot have an ally then a
             | worthy foe is almost as good ;)
        
       | sparker72678 wrote:
       | Who was going to make it happen? Microsoft was so dominant, and
       | no one wanted another language that MS owned coming down the
       | pipe, and there wasn't really anyone left to have the resources
       | to push something else, even if they'd wanted to.
       | 
       | These were the days when Microsoft was M$, and it might be hard
       | to remember just how anti open source they were. There was just
       | _no way_ M$ was going to support a new (or existing) open source
       | language in IE unless they were forced.
       | 
       | And none of the niches that loved those languages had any
       | interest in working with M$ to "embrace and extend" their
       | language of choice, so it's not like there was a lot of
       | cooperation out there.
        
         | dcminter wrote:
         | You forget that at the height of the browser wars Netscape was
         | vying with Microsoft to add new features and they didn't
         | particularly need to be compatible; remember Javascript wasn't
         | (initially) available on Internet Explorer, it was Netscape
         | _only_ for at least a year or two. I wonder that Netscape didn
         | 't add a few more languages to the party as a fire and motion
         | exercise against the competition.
         | 
         | The moment "does it run on IE?" became uppermost in developers
         | minds was (as I see it) the moment the original browser wars
         | ended and the long cold war began. But there was a cambrian
         | explosion of often-incompatible features before that.
         | 
         | Edit: I definitely buy that as the reason that IE didn't adopt
         | any other languages, though, and maybe there just wasn't time
         | for Netscape to bolt another one on? Or maybe their great
         | rewrite got in the way (I'm hazy about the timeline for that).
        
           | sparker72678 wrote:
           | Hm, yeah I wonder if there was really time/resources for
           | Netscape to pull that off if they'd even wanted. There was so
           | much going on with HTML/CSS/etc. simultaneously.
           | 
           | And it definitely wasn't certain at the time that a scripting
           | language, running in the browser, was going to be The Future.
        
       | the_only_law wrote:
       | > But the browser-supported languages seems to have been almost
       | entirely Javascript and VBScript.
       | 
       | FWIW I recall only being able to use VBScript in IE (maybe there
       | was a way to run ActiveX components in other browsers?)
       | 
       | I want to say tho, that many (most?) MS Active Scripting
       | languages could run as client scripts, at least I recall Perl
       | ones running in a browser context through ActivePerl.
        
         | eqvinox wrote:
         | My (hazy) memory says early IE only did VBScript, trying to
         | "win out" against JavaScript, then MS "invented" JScript, until
         | at some point they gave up and added JavaScript.
         | 
         | And yeah I used PerlScript (ActivePerl) in some hacks, but you
         | had to install that separately which pretty much killed it.
        
       | floxy wrote:
       | Tcl
       | 
       | http://www.tcl.tk/software/plugin/
        
         | 0des wrote:
         | Tcl is so useful, I wish it would have taken off more than it
         | did. I do a little 'chef kiss' every time I talk about how
         | useful Tcl/Tk is/was in its day...
         | 
         | Then we settled for PHP somehow :/
         | 
         | Followed by the drupal era.
        
       | rshnotsecure wrote:
       | An interesting fact is that JavaScript really has nothing to do
       | with Java. They paid Sun $5 million to license the word "Java",
       | because it was an extremely popular language at the time.
        
         | dcminter wrote:
         | And don't I as a Java developer hate the people who made that
         | decision . TO THIS DAY it confuses people (often in HR) that
         | they're not the same language.
        
       | GoblinSlayer wrote:
       | IE supports ActiveX controls that you can write in literally any
       | language.
        
         | eqvinox wrote:
         | Not anymore, it doesn't ;)
         | 
         | https://en.wikipedia.org/wiki/ActiveX
         | 
         | > Microsoft dropped ActiveX support from the Windows Store
         | edition of Internet Explorer 10 in Windows 8. In 2015,
         | Microsoft released Microsoft Edge, the replacement for Internet
         | Explorer with no support for ActiveX, this event marked the end
         | of ActiveX technology in Microsoft's web browser development.
        
       | eqvinox wrote:
       | Supporting any additional language would've required integrating
       | it into the browser engine. Which, in 1995, was pretty much
       | either Netscape Navigator or Internet Explorer (2.0-ish.) Even
       | Mozilla didn't exist before 1998.
       | 
       | So, while I certainly can't make any statement on what was in
       | people's heads at the time -- I'm pretty sure trying to integrate
       | a new scripting language into either of those two would've been a
       | daunting task. And both of these vendors would have had some
       | interest in making you not succeed. (MS pushing VBScript [later
       | JScript], and Netscape had some major involvement in JavaScript
       | AFAIR.)
       | 
       | ...oh and presumably your additional language wouldn't come
       | included with the browser, and not having to install additional
       | shit was kinda the entire point of JavaScript...
        
       | pestatije wrote:
       | Yes, the browser was a winner-takes-all battle that took all
       | major players to the path of my-technology-is-better-than-any-
       | standard-technology.
       | 
       | In this regard, javascript was itself being pulled from different
       | sides at the same time as well. The surprising thing, in my
       | opinion, is that it managed to get in one piece after all.
        
       | h2odragon wrote:
       | I don't think I saw it articulated, but I had the sense that
       | there was a wide belief that the Web needed a new, original
       | language of it's own; that the existing languages would impose
       | too much framework and worldview on totally chaotic evolution.
       | Jskirpt _sucked_ , but it was at least in a position to evolve
       | and become better, which was the main thing that was desired of
       | it right then. Anything else that was invented near its time and
       | purpose invariably had even more suck and less feature.
        
       | krapp wrote:
       | I think one language turned out to be good enough, given what
       | little could actually be done with scripting in the early days.
       | There just wasn't any actual benefit to supporting multiple
       | languages, each of which would need to be a fork with its own DOM
       | API anyway.
       | 
       | Of course, Google tried with Dart, but that never went anywhere.
        
       | m0llusk wrote:
       | At first Java was considered the ultimate sandboxed client
       | language, though it ended up going in a different direction.
       | Javascript was strictly for silly animations and promotional
       | winky blink until AJAX XMLHttpRequest and Javascript the Good
       | Parts. VBScript was a Microsoft Windows centric sideshow for IE
       | junkies.
        
         | dcminter wrote:
         | Don't forget client side form validation as the main pre-AJAX
         | "serious" usage. Often in the sense of "seriously misguided"
         | when there was no corresponding server side validation of
         | course!
        
       | alfonsodev wrote:
       | The Web introduced the idea of the DOM[1] and Javascript was
       | created to embrace it and extend it making it programable, while
       | Java applets and Flash didn't respect the idea of The Web and
       | didn't embrace the DOM at all, so maybe a false dichotomy was
       | created were either more robust programming languages had to have
       | the full control of the browser skipping The Web (too limiting?)
       | and in the other hand for just operating the DOM Javascript was
       | enough.
       | 
       | [1] https://developer.mozilla.org/en-
       | US/docs/Web/API/Document_Ob...
        
       ___________________________________________________________________
       (page generated 2021-07-30 23:02 UTC)