Re:Google introduces Dart, a new programming language for we...
by tomp on Monday October 10, 2011 @10:59AM
(#3094032)
You're assuming that all code found on the web is well-written, without bugs and with no malicious intents. Both Java and CLR bytecodes are designed specifically in a way so that they are verifiable, so that the compiler can be sure that the code doesn't do anything it's not supposed to do (e.g. access IO functions, write to unallocated memory, spawn new threads, ...). Also, a browser has to be able to ensure that untrusted code can only use a limited amount of resources, that is why we have garbage collection, and VMs (interpreted/JIT compiled code can be controlled and interrupted more easily than native code).
Higher level constructs carry more semantics, that is why they are easier to verify/sandbox.
Re:Google introduces Dart, a new programming language for we...
by overgard on Monday October 10, 2011 @11:17AM
(#3094113)
I am assuming no such thing, that's why I suggested pointers and such should be left out. I'm not actually literally suggesting that we put C in a browser, I'm using it as a design metaphor. You can do fast and low level without C style pointers (for example, fortran* .. not that I'm advocating fortran either )
Sidenote: GC wouldn't prevent anyone from stealing a lot of resources. Either way you can ask for a lot of resources and not give them back.
* Yes I know fortran has a thing called a pointer, but it's a lot different.
Re:Google introduces Dart, a new programming language for we...
by cousin_it on Monday October 10, 2011 @12:17PM
(#3094423)
How about using ordinary machine code and making the browser behave like VMWare? Such an approach would be good for both speed and safety, no? Yeah, that would require webapp authors to make separate binaries for different architectures, but if they're writing some monstrosity like a web version of Photoshop, they want that level of control anyway! Meanwhile the rest of us can keep on using HTML and hop off the standards treadmill.
I imagine for this web version of C -- and it should be a language, not a byte code format -- it would need to satisfy these properties:
- language constructs that map semi obviously to machine instructions (ie, you don't need to spend a lot of time guessing what "switch" or "while" or "struct" get turned into), while avoiding things that might not be so obvious. (What does a closure look like in assembly? Or a generator?)
- types that correspond to machine types
- some sort of predictable and low level memory model (without pointers, but with some sort of way to avoid garbage collection issues. Maybe something with reference counting)