4 ms·
And if that VM ran on over 2 billion devices, on every toaster out there? In the end, this all is just reinventing the JVM, in slower, but more secure.
by kuschku 9y ago
And if that VM ran on over 2 billion devices, on every toaster out there?
In the end, this all is just reinventing the JVM, in slower, but more secure.
- eriknstr 9y agoI think that's what parent commenter was implying. (However, I don't agree. I remember the horrible Java applets and I am thankful that I pretty much never encounter any of them these days.)
- lvh 9y agoIs the horribleness of applets intrinsic in the concept of a common target?
- matt4077 9y agoIt might be, because "common target" implies a lack of competition.
- duskwuff 9y agoIMO: No. It was more of an implementation issue. When Java applets were first implemented, the web platform was still extremely limited -- HTML was still at version 2.0, CSS and the DOM didn't exist yet, and Javascript was still very new. So it made some sense, at that point, to have Java applets exist in their own "world", and not interact with other web content. A modern Java applet environment would probably look very different. More of a focus on providing a bridge to the browser's DOM, less of a focus on building UIs using native Java frameworks (like AWT or Swing).
- acdha 9y agoIt's definitely a challenge trying to balance portability with support for platform specific features but I'd be a little hesitant to draw general conclusions from the two big examples since both Adobe and Sun were notoriously negligent platform maintainers addicted to haring off after some shiny whim before fixing what they had already built. Even simple things like if Sun cared about non-server performance in the 90s or if either of them had figured out how to properly package and ship updated before the 2010s could have improved their reputation immensely.
- coldtea 9y ago>I remember the horrible Java applets and I am thankful that I pretty much never encounter any of them these days.) Yeah, yay for progress and horrible Electron apps..
- eriknstr 9y agoElectron apps are not really relevant when talking about Java applets. Java applets embed in the browser, so compare Java applets with HTML5, CSS3, JavaScript and WebAssembly. I much prefer the latter (HTML5 + CSS3 + JS + WebAsm).
- douche 9y ago> In the end, this all is just reinventing the JVM, in slower, but more secure More secure?
- jcranmer 9y agoProbably the biggest cause of security bugs in Java applets is the fact that the applet execution environment is a full JRE, with all the APIs involved in desktop JRE instances available, with "insecure" ones being locked down on an as-needed basis. So if a developer forgot to insert a security check in the JVM, the applet becomes able to subvert its sandbox. The browser VMs don't have these APIs available in the first place, so getting undesirable access to things like the filesystem is much more difficult than "spot the API with the missing check."
- haberman 9y agoWere you around in the 90s when people actually did try to use the JVM for this? Do you remember the part where everyone started using JavaScript instead because of all the deficiencies of Java Applets? (Slow to load, resource intensive, no interaction with the surrounding page)
- kuschku 9y agoI was, and I wasn't saying that WebAssembly is bad — but I'd have preferred compatibility with Java bytecode, even if it'd offer different APIs.
- pcwalton 9y agoIt's reinventing the good part of the JVM (the JIT and the bytecode), better than the JVM (unsigned ints and value types are supported), without the bad parts of the JVM on the Web (the libraries, including the slow graphics stack, etc.) What's not to like?
- lmm 9y agoWhat do unsigned ints bring to the table? I'd use them in C to avoid undefined behaviour, but that's not a problem on the JVM. Value types sure, I guess, but they don't seem super important. Can't we just make DOM bindings for the JVM and reuse the huge existing library base?
- camgunz 9y agoWithout unsigned types you have to use the next larger type and mask. It's ugly, a pain, and slower. You run into this problem a lot when dealing with binary data.
- lmm 9y agoYou're begging the question, assuming you have to represent a particular unsigned type to start with. What's the problem that you're trying to solve? I appreciate that e.g. particular image formats are defined in terms of unsigned integers of particular sizes, but parsing binary formats seems like a specialized use case that's not worth distorting the whole language over (and it already involves fiddling with endianness, so you can't directly use the "standard" version of a given-sized integer when parsing).
- pcwalton 9y ago> parsing binary formats seems like a specialized use case that's not worth distorting the whole language over (and it already involves fiddling with endianness, so you can't directly use the "standard" version of a given-sized integer when parsing). You call it "distorting the language", I call it "exposing the capabilities of every single CPU manufactured in the last 15 years". > You're begging the question, assuming you have to represent a particular unsigned type to start with. What's the problem that you're trying to solve? 1. Compiling existing C++ codebases. 2. Multiplication and division are not identical for unsigned and signed values. Say I have a memory address on 32-bit (note that this applies equally well to 64-bit) and I'm doing pointer arithmetic. I'd better not be doing a signed multiply, or else values above 2GB will be corrupted!