Feeds

back to article Google's JavaScript assassin: Web languages are harder than VMs

The problem with programming languages is that everybody’s got an opinion - just ask Lars Bak, the Virtual Machine guru who is building Google’s planned (by Google at least) replacement for JavaScript. Bak has spent 15 years working on object-oriented VMs (virtual machines) at Google and Sun Microsystems and notched up 50 …

COMMENTS

This topic is closed for new posts.

Page:

VM

I would have thought a language-agnostic browser VM (something like LLVM, CLR etc) would be better than another language. Write in whichever language you fancy and compile to the VM's instruction set and off you go.

2
0
Ru

Re: VM

We've ended up in the slightly surreal situation whereby javascript has become some sort of web assembly language... there's a vanishingly small chance of anyone agreeing on upgrades to javascript or substantially different new platforms, so instead we're ending up with languages like Typescript and Clojurescript and Coffeescript which "compile" to javascript because most people actually have browsers which support it.

Seems daft, but at least you have a bare minimum of choice and can reasonably expect to be able to run your code on most browsers. A new VM, supported by Webkit, Chromium, Mozilla and Microsoft? I'm not going to hold my breath.

9
0
Anonymous Coward

Re: VM

" there's a vanishingly small chance of anyone agreeing on upgrades to javascript"

Indeed, but it would be nice to have something supplant or rather compete with JS in the browser (so long as it looks and smells nothing like that VBScript abomination).

It would be nice to have the option of prototype and OO. But the chances of it happening wholesale and any-time soon are slim to none - more's the pity.

I for one fail to understand why so many developers out there are so mentally entrenched with JS that they decry any effort to introduce anything new.

2
0
Ru

Re: VM

I for one fail to understand why so many developers out there are so mentally entrenched with JS that they decry any effort to introduce anything new.

Stockholm Syndrome? ;-)

No... this is just corporate politics at work. Look at the brouhaha around Javascript 2/ECMA script 4.... same arguments about develepers but largely not by developers.

The cynical side in me also wants to point out that current web "standards" like javascript and CSS and the like have "less than brilliant" compliance across all platforms. Adding a new and complex standard like a new bytecode language? Even if the big browser manufacturers wanted to support such a thing, do you suppose they'd do a good job of it?

2
0
Silver badge

Re: VM

A language-agnostic browser VM sounds like an excellent idea. The variety of languages targeting JVM, which was probably never supposed to be language-agnostic, suggests this would be very productive approach.

One would also hope that such a VM could take care of the security issues that are always lurking in the shadows when programs run in the browser.

2
0
Silver badge

Re: VM

LLVM isn't really a VM per se as set of portable low level instructions which can be translated into an equivalent set of native instructions. So a browser could download bitcode and compile, cache and execute the native or it could run the bitcode through a JIT compiler each time. It could also instrument the native code with any security checks it liked to keep the app in a sandbox and prevent it busting out.

Browsers *really* need something like LLVM. It's crazy that tools like Emscripten, GWT etc compile one language into a scripting language where performance is really awful. If code were compiled to bitcode it could run at near-native speeds and do so in a way which is browser and OS neutral.

Google promised something called PNaCl for ages which would implement LLVM in their browser. It's emerging from development but it's still too early to say if it's portable to other browsers, or even if they'd be inclined to support it. I doubt Microsoft or Apple would support it though Mozilla might.

Regardless of politics this is something that browsers really need.

2
0
Anonymous Coward

Re: VM

"The cynical side in me also wants to point out that current web "standards" like javascript and CSS and the like have "less than brilliant" compliance across all platforms. Adding a new and complex standard like a new bytecode language? Even if the big browser manufacturers wanted to support such a thing, do you suppose they'd do a good job of it?"

You know, I could not agree more with everything quoted above. But are they valid reasons not to pursue such a goal? I'm not so sure. Is JS the pinnacle of what client-side could be? Far from it!

Either way, I would still like to have the option of prototype and OO and think it's a goal worth setting.

3
0
Bronze badge

Re: VM

If it is only about the lack of typing, then surely something like typescript is a better option.

Another VM just sounds like JVM, Flash, Silverlight etc and will end up with the same problems.

0
0
Anonymous Coward

Re: VM

Too many dickheads at companies like Google, Microsoft and Apple that's why.

Look at what happened with HTML5 video, nobody could agree on a standard. Google pushed their standard against Apple and Microsoft.

What should have happened is a central impartial organisation should have proposed it and everyone adopt it.

Google will push a standard which gives them some control or advantage over Microsoft and Apple. Microsoft and Apple will do the same.

0
0
Silver badge
Meh

Re: VM

a central impartial organisation

I think I saw one of those riding a unicorn once...

4
0
Anonymous Coward

Re: VM

Somebody has actually ported an x86 VM environment to Javascript and you can now boot Linux in your browser :-)

http://bellard.org/jslinux/

(a bit slow, as you can imagine)

0
0
Silver badge

Re: VM

> Another VM just sounds like JVM, Flash, Silverlight etc and will end up with the same problems.

There is a difference. If it also compiles to javascript, then you only write once and just load either dart or JS into the browser an request. The VM's mentioned above have platform limitations.

Google has enough of the browser market via chrome and (more importantly) android to make this work. This might make web apps (which are horrid enough on a pc) work faster so mobile devices can run them.

As long as it compiles properly to JS as well, google can afford to go it alone. If gmail runs faster under chrome than anything else, so be it, hotmail doesn't need to come along for the ride. You might eat more memory running a JS VM and a Dart VM, but memory is cheap.

The aim of dart/NaCl etc is to get web apps running at a decent speed to bypass MS' grip on the desktop.

0
0
JDX
Gold badge

Of Course!

The best thing to replace JS, a browser-specific language without decent dev tools, is not an existing language used across desktop & server platforms with a mature set of tools and proven track record, but ANOTHER new language. Because we don't have enough of those already.

7
6
Flame

Re: Of Course!

Well, Java proves to be a bug-riddled ball of crap, worthy of M$. There is little hope it will ever be reasonably secure to run untrusted code. JS suffers from too many bad design decisions.

A memory-safe language is required, so they create one of their own. Sounds reasonable. I do think, there should be more attempts like this to fuel the fire of language darwinism.

Picture: A fire of burning language specifications.

0
6
JDX
Gold badge

Re: Of Course!

Java isn't a bug-riddled piece of crap, one particular implementation is.

If existing languages are all unsuitable, how come we haven't all switched to something new? The last new language to get mass acceptance was C#... even Python and Ruby remain bit players.

0
0
Silver badge
Stop

Just as long

as noscript stops it running...

13
0
Thumb Up

Re: Just as long

Sometimes, I wonder if all these Javascript performance improvements brought anything of value to normal users. Most JS is just tracking upon tracking for advertising reasons.

2
0
Stop

"a prototype-based language"?

from http://www.dartlang.org/

"FAMILIAR

Dart is a class-based, object-oriented language..."

1
0
Bronze badge

Re: "a prototype-based language"?

Unless the article has been corrected the article does say that dart differs from javascript in this respect, i.e. not prototype based.

0
0
(Written by Reg staff) Silver badge

Re: "a prototype-based language"?

Oops, some wires crossed. It's been clarified.

C.

0
0

Death to Javascript

Any language where ("0" == false) resolves to true is just plain wrong. Javascript is only used because theres currently no in-browser alternative, not because its any good. So good luck to Dart to try and displace it. It can't do a worse job.

13
1

Re: Death to Javascript

I dunno, in a language where strings and numbers are interchangeable to some extent (eg you can add them together), then it makes sense that if 0 resolves to false (as it does in C/C++), then so should "0".

Having said that, it's about time we had a decent, fully oo, client-side scripting language.

0
0
Boffin

Re: Death to Javascript

Why not use the type equivalent operator ("0" === false) ?

3
0

Re: Death to Javascript

Because you shouldn't have to. The fact that === is included in the language as a cheap fix simply underlines how wrong it is.

3
3
Anonymous Coward

Re: Death to Javascript

JavaScript is a dynamically-typed language.

"0" == false is a natural consequence of dynamic typing. To avoid it you have to add complexity by making booleans a special case or reduce flexibility and eliminate them entirely.

Dynamic typing is annoying, but with JavaScript being heavily built on associative arrays it makes the language very simple.

4
0
Stop

Dart runs 130 per cent faster

"The goal is for Dart to become twice as fast."

If I did the math right, are they trying to slow it down?

Twice as fast is 100% faster...

STOP, because they are going too fast!

3
2

Re: Dart runs 130 per cent faster

You beat me to it. I assume they mean it runs at 130% of the speed, ie 30% faster.

1
0
(Written by Reg staff) Silver badge

Re: Dart runs 130 per cent faster

Point taken. It could be that Dart is running 130% faster but the target is twice that. Or it could be 30% faster but the target is 100%. We'll go back to the source to check this one.

PS: On busy days thousands of comments are posted; we never get the chance to read them all so problems like this can go unnoticed. If you hit the corrections button on the article, we'll be able to fix problems immediately :-)

C.

2
0
WTF?

In what way is ColdFusion in decline ? http://blogs.coldfusion.com/post.cfm/product-roadmap-for-coldfusion

And don't get me started on what the Railo Foundation means for a FOSS implementation of the language, owned by JBoss : http://www.opencfmlfoundation.org/projects/railo/

1
0
Silver badge

In This Way

1. Netcraft hasn't even bothered mentioning them since 2003:

http://news.netcraft.com/archives/2003/08/30/php_growing_surprisingly_strongly_on_windows.html

2. According to w3techs "the" server-side scripting of the late 90s now powers just over 1% of dynamic sites:

http://w3techs.com/technologies/overview/programming_language/all

and

3. That's in steady decline:

http://w3techs.com/technologies/details/pl-coldfusion/all/all

1
0
Happy

Phew!

Curly-braces!

syntax-significant whitespace always gives me the heebees......

15
0
Silver badge
Thumb Up

Re: Phew!

"syntax-significant whitespace always gives me the heebees......"

Seconded. IMO its the one stupid design decision that stops python being a first class language. But unfortunately a language where accidentaly deleting a space or tab can change the whole flow of the code but remain syntatically correct has a major design flaw.

eg:

for i in xrange(1,10):

..func1()

..func2()

vs

for i in xrange(1,10):

..func1()

func2()

5
0
Gold badge

Re: Phew!

In a perfect world, *all* programming languages would decouple their source syntax from their semantic elements. How hard could it be to write a front-end that accepted curly braces instead of significant white-space and then fed the resulting parse tree to *exactly the same* compiler? Probably "very", in real life. How hard *should* it be? Probably "trivial", since the formal tools for this were developed 50 years ago, by language designers.

In fact, my new figure of merit for whether to take a new language seriously is "Does the default distribution come with multiple front ends to accomodate the various syntax prejudices of the programming community?". If not, I'm not interested. :)

2
1
Anonymous Coward

Re: Phew!

I'm with you. In fact when I'm king, they'll be universal interpreters and universal compilers. If you're writing an interpreted programming language, it'll just be a wrapper and you'll hook it up to one of the universal interpreters using some standard protocol/api/whatever. The universal interpreter can hook into universal standard libraries SO THAT EVERY FUCKING LANGUAGE DOESN'T HAVE THE SAME CORE OBJECTS WITH SLIGHTY DIFFERENT METHOD NAMES/SYNTAXES.

2
0
Happy

Re: Phew!

Ha!

That would be far too sensible for the world and might set a dangerous precedence of co-operation.

Long live the new king, if it is Anonymous Coward :)

0
0
Megaphone

Re: Phew!

Steve Ballmer! Welcome to the register. But next time, just use your real name, we know who you are ;)

0
0
Anonymous Coward

Not so much

The problem with that is that it would come at a severe performance cost, hence why it's not done. Designing a language is much, much more difficult than using one. I'm assuming you didn't take Programming Languages in College? Because if you had, you'd realize that your point is absurd in real life, even if it does sound nice on paper.

0
2
Silver badge

Re: Not so much

I agree with you, but this is less true with properly OO languages, where differences in syntax hide a much bigger underlying similarity in function. Look at Smalltalk - in one sense (class libraries) it is absolutely enormous but in another (syntax) it is minute - it doesn't case statements, if-then-else or loops.

The only thing wrong with Smalltalk bytecode is that it was not secure, and that was, if I recall, one of the underlying principles of Java bytecode design (not that it worked completely). A standard bytecode into which a bunch of different OO languages could be safely compiled would be a wonderful thing.

0
0
Bronze badge

Re: Phew!

>Curly-braces!

Curly braces always give me the heebeejeebees.

I'm left handed, and a touch-typist from age 8. It was years before I relealized that one of the reasons I hate curly-brace languages is that those keys for which I use the Little Finger on my Right Hand, are actually the slowest and most difficult keys on the keyboard for me.

And, of course, as a long-time touch typist, I'm not appalled at the effort of typing

Begin End

.OR.

Balance equals Balance plus ItemCost

(astute readers will have noticed that I put a decimal point on either side of that uppercase OR...)

1
4
WTF?

Re: Phew!

You're going to re-invent C?

0
0
Anonymous Coward

Re: Phew!

Curly braces are just an alternative to terminators. They make sense in a brief language but not in a verbose one.

I don't like the idea of syntax-significant indentation either, but I do like strict indentation.

0
0
WTF?

All your web are belong to us

"By borrowing from C++ and Java, the idea is Dart is familiar yet even easier and quicker to code in, and should generate fewer bugs – called side effects."

*...eyeroll...*

9
0
Gold badge

Re: ...eyeroll...

Ditto.

"side effects" is the term used by most language designers to refer to "evidence that your program is actually running". If a block of code has no side-effects, the optimiser is allowed to remove it. If two blocks have the same side effects, it is allowed to pick the cheapest one. Side effects are not equivalent to bugs unless your code is 100% bug.

3
1
Paris Hilton

Re: ...eyeroll...

I have to quibble with this.

Side-effects refer to effects a method or function has other than its return value. A common best practice is to eliminate all side effects b/c it makes the code a lot easier to test.

Of course, at some point your code has to have side effects - it has to draw on the screen, or send packets, or whatever the point of the program is. However, the core of the program can still operate "without side effects."

4
0
WTF?

Re: All your web are belong to us

"By borrowing from C++ and Java, the idea is Dart is familiar yet even easier and quicker to code in, and should generate fewer bugs – called side effects."

Don't forget about the non nullable objects in Dart. A complete disaster. Just for that, Dart is DOA.

0
0
Stop

My Two Cents on A Browser Language

* Don't use a VM. Compile stuff directly into machine code. All of it..

* Allow for synchronous destructors and refcounted pointers.

* Free yourself from the retareded ideas of Mr Gosling and the other academics. These will only generate bloat and crappy user experience.

Basically, make it a memory-safe Delphi/TurboPascal variant. That will both compile extremely fast and the program will run very efficiently. No random freezing.

2
10
Facepalm

Re: My Two Cents on A Browser Language

"* Free yourself from the retareded ideas"

It's "retarded".

3
2
Anonymous Coward

Re: My Two Cents on A Browser Language

Yeah. Typo. Any replies to my arguments, by chance ?

2
4

Re: My Two Cents on A Browser Language

> Compile stuff directly into machine code

Which instruction set?

Or do you mean distribute the source and compile on-demand (which is pretty much what modern JavaScript engines do)?

3
0
Anonymous Coward

Re: My Two Cents on A Browser Language

Exactly. Distribute Source Code and let the browser compile it into the local instruction set on the fly. Not "JIT", but "Turbo-Pascal Time" (so to speak).

0
3

Page:

This topic is closed for new posts.