4 ms·
Google Native Client - Part 1
- samuel1604 14y agoThis is impressive, it would be nice when people adopt that, I wonder if we could make a python for browser out of it.
- biomechanica 14y agoI know that the Mono C# is now supported. I think it's due to its LLVM support. So basically, any language that supports LLVM JIT can be used with NaCl. I could be wrong, but I remember reading about it somewhere. Either way, it is pretty cool technology of which nobody else seems to want to support. Which is too bad, really.
- quonn 14y agoYes, but Google contributed a huge patch to Mono to make it work, making changes in the runtime all over the place. So LLVM is not the reason, at least not in this case. Maybe there is also a NaCl backend for LLVM, I don't know ...
- biomechanica 14y agoYes, I believe it is called PNaCl. It uses LLVM as its back end. edit: I suppose a link should be presented. http://www.chromium.org/nativeclient/pnacl/building-and-testing-portable-native-client http://www.chromium.org/nativeclient/pnacl/building-and-test...
- kayoone 14y agoNative Client Adoption by all browsers would be awesome for the gaming market and would also provide alternatives to Javascript, which many people would like i guess.
- azakai 14y agoIn the short term, sure. But since NaCl doesn't run on all CPUs and is not standardized, it would lead to problems in the long run. Regarding alternatives to JavaScript, you can compile pretty much any language into a form that can run on the web, right now: C++, C#, Java, etc. (That form happens to be JavaScript.)
- wickedchicken 14y ago> But since NaCl doesn't run on all CPUs The PNaCl project[1] aims to distribute LLVM bitcode, solving this problem. You also gain the advantage that all programs can be JITed to exactly your processor spec. [1] http://www.chromium.org/nativeclient/pnacl http://www.chromium.org/nativeclient/pnacl
- azakai 14y agoIt aims to do that. It isn't finished and it is not clear what the final product will look like in terms of portability and performance.
- quonn 14y agoI would really like to see that all NaCl apps have to ship at least a PNaCl binary (and possibly ARM as well). Browsers should verify this and refuse to run apps that are x86 only. If all NaCl apps would contain PNaCl/x86/ARM binaries I don't see a disadvantage compared to compiling other languages down to JavaScript (which is just as unreadable/proprietary). Also it's certainly an improvement over native plugins that not only lack a sandbox, but are also tied to the OS in addition to the CPU. In fact, I suggest that browsers should adopt NaCl at least for plugins, maybe even allowing unrestricted access to the file system, camera, etc. and gradually phase out conventional plugins. Even without the security benefit this still gives us portable plugins.
- azakai 14y ago> If all NaCl apps would contain PNaCl/x86/ARM binaries I don't see a disadvantage compared to compiling other languages down to JavaScript (which is just as unreadable/proprietary). Even if PNaCl worked today, and even if it gave good performance and portability, it would still not be standardized. The only way to get PNaCl into a new browser would be to use the current implementation (which defines what it is). Having that implementation open source is a good thing. But it isn't as good as JavaScript which has a standard and multiple independent implementations. If you want to write a JS engine in Haskell, for example, you can do that. You can't do that with NaCl or PNaCl, you must use the existing code as is.
- danielweber 14y agoLast time I did a web search for how to write something for Google Chrome in a language other than Javascript I found nothing. Where is the "hello world" for writing a plugin/chrome-app in some other language?
- pslam 14y agoGoogle should be pushing Portable Native Client, not plain Native Client, which is by implication Non-Portable. NaCl solves Google's problems, but is a damaging standard for the rest of us. Nobody should be pushing CPU architecture specific executables as a web standard. Yes, you can compile is for x86 and ARM, but that's incredibly short-sighted. What about PPC? MIPS? Some future architecture that hasn't been invented yet? Do we have to make a virtual machine then? Yes, you can also compile as LLVM bitcode, but then why give prejudicial preference to x86-32 and ARMv5? (Note the specific versions there) You might as well just ship as PNaCl and skip NaCl altogether. PNaCl is an amusing evolution of web scripting: we've come full circle from a JVM thru Javascript back to a solution which is almost a JVM. To be cynical, it seems like an awfully huge project just to avoid writing Java.
- gsnedders 14y agoHeck — we're already having enough pain as Typed Arrays expose system endianness to the web platform. Most scripts using Typed Arrays are already broken on big endian systems, and it's practically inevitable that Typed Arrays are going to have to convert endianness dynamically to appear little endian.
- saurik 14y agoFWIW, LLVM offers other advantages over a JVM, such as letting you not have to use things like garbage collection and strict typing (as in, you can have arrays of random garbage that you type cast back/forth through structures and unions; that's all allowed in LLVM, and all considered safe by way of PNaCl AFAIK, as it doesn't care whether your program works or fails, only that it doesn't escape).