
Google Native Client - Part 1 - wglb
http://blog.leafsr.com/2012/08/google-native-client-part-1.html
======
pslam
Google 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
Heck — 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.

------
kayoone
Native 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
In 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.)

~~~
haberman
PNaCl targets LLVM bitcode, so can be supported on any modern CPU:
[http://www.chromium.org/nativeclient/pnacl/building-and-
test...](http://www.chromium.org/nativeclient/pnacl/building-and-testing-
portable-native-client)

Compiling other languages to JavaScript imposes an unacceptable speed penalty.
C++-to-JavaScript is not a viable platform for real applications, especially
anything performance-critical.

~~~
gsnedders
Except, of course, LLVM bitcode isn't meant to be distributed: it's designed
as a compiler IR, and merely an intermediary form. It's also not portable: the
existence of types like x86_fp80 and ppc_fp128 make this quite clear.

~~~
haberman
I suggest reading the PNaCl paper, which addresses how they make LLVM bitcode
distributable and portable. Because believe it or not, they have thought about
these problems, and solutions to them have been designed and implemented.

It's not a force-fit either. LLVM is designed to be a form from which machine-
specific code is generated. The problem is only that different platforms have
different conventions. But any modern 32-bit platform can use a given set of
conventions if you want it to.

------
samuel1604
This is impressive, it would be nice when people adopt that, I wonder if we
could make a python for browser out of it.

~~~
biomechanica
I 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
Yes, 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
Yes, 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-
test...](http://www.chromium.org/nativeclient/pnacl/building-and-testing-
portable-native-client)

------
danielweber
Last 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?

