Java and Javascript are related like Car and Carpet are similar.
There was no historical connection between Java and JavaScript beyond renting the brand "Java" from Sun to make the language more credible.
Well, it's possible that if it hadn't been for Java JavaScript might have had a decent, parens-based syntax.
I still wonder what might have been if Eich had been allowed to write the Scheme system he had been hired to do. While I'm not a fan of Scheme by any means, it is approximately 281,757,423,024,353 better than JavaScript.
And Scheme's a great little language for implementing other languages. Imagine, we could have had transpiling years ahead of time. We might be using S-expressions instead of JSON. Heck, we might even have moved to an S-expression syntax for HTML & CSS by now.
I'm a HUGE fan of Scheme. And of Lisp, in general. But having seen in the "real world" how so many people are so adverse to Lisp's beautiful syntax, I'm pretty confident that JavaScript would never have caught on if it looked like Lisp rather than like C.
They wouldn't have had a choice, though, just as folks don't have a choice with JavaScript.
I imagine that folks would have cottoned on to the advantage pretty quickly. And those that didn't … I guess they could have always become telephone cleaners or something:-)
Browsers worked just fine before the advent of Javascript. Nobody had to use it, but they decided to use it because it was good enough. If some other language was deemed not good enough, there would have been more aversion to using it, and it would have never taken off.
Not to mention that there were other ways to execute code in the browser in those days. We have 'no choice' but Javascript today simply because it's the option that people eventually gravitated towards, forcing the others out of the market.
They decided to use it because it let you add things like drop-down menus (and falling snowflakes!) to your website, which made it look better than your competitor's website. Syntax was just the hoop to jump through to achieve that, and a very minor one at that. I doubt it would have made any difference.
You honestly believe that Javascript would have been equally successful if it had shared similar syntax to, say, Brainfuck? Especially given the alternatives that were available at the time? If syntax doesn't matter, I guess so, but I'm not sure I'm convinced.
I was talking specifically about the Scheme-like syntax that JS originally had. That syntax was a minor obstacle. BF-like syntax would be a far bigger one. Although what would probably have happened then is the same thing we saw with JS anyway - someone would have made a transpiler from something more sane - except it would have happened much faster.
There is a big difference, but since we're talking about any language "deemed not good enough", a language similar to Brainfuck definitely applies, and perhaps is the shining example.
The original suggestion was that people would use Javascript, or any other language in its place, simply by virtue of it being the only option. I argue that the wrong language would hamper adoption, and eventually some other language – like, say, VBScript which came only 6 months later – would have taken over.
Javascript persisted, and eventually completely dominated, because it was good enough. A language not good enough would have not had the same success, even given the otherwise same environment to grow up in.
IME it's a learned thing from only knowing languages that at least superficially resemble ALGOL.
IME many computer programmers learned Lisp in college and for some reason hated it–I think in part due to the syntax and in part because they had a hard time with recursion and other "mind-bending" concepts. They often still harbor an irrational precedent to this day.
Me, on the other hand, I loved Lisp as soon as I learned it. (Perhaps I was primed by having learned APL in high school.) I changed my major from Astrophysics to Computer Science because I felt that SICP was even cooler than black holes and neutron stars.
> They wouldn't have had a choice, though, just as folks don't have a choice with JavaScript.
If people disliked the syntax enough to avoid the language (and the browser that uses it), I imagine that other browsers would've started supporting other languages, and something else would've dominated.
Browsers actually did support other languages back then. Remember VBScript? IIRC there was also an attempt to draft Tcl into that role.
In IE world, things were actually even crazier, because the whole scripting story was extensible (via Active Scripting). So you could use Perl, for example...
Pure Scheme would not be sufficient. You need at least DOM-handling libraries. And if those libraries were poorly designed, then people wouldn't cotton onto the advantage quickly. Look at DSSSL.
Did you see the '(set! (inner-html (get-element-by-id document "demo")) "Hello JavaScript!")' bit? That's DOM-handling in Scheme. Not a really great API, but it's not terrible either.
Just about every modern Lisp has an X-Expression library, and having used Racket's in production, it's a hell of a lot better than the DOM browsers have today.
Yes and no. In practice JavaScript was sometimes the thing that detected if Java was present and kicked off a Java applet. It also handled roll-overs before CSS was a thing, doing mundane stuff by comparison to what a full Java app could do. It was intended to be complementary.