40 points · by duck · 15y ago · 45 comments
Ok, ok- so we use a VM that everyone agrees on and- wait, we're back where we started, aren't we? Except, of course, we have a ton of mandatory overhead because browsers are no longer specialized to deal with the kinds of media users expect in a browsing experience.
Unless you honestly expect that everyone, everywhere will use identical computers for everything, standardized formats will always be necessary.
Between ye olde Java sandboxing, hardware and software OS virtualisation (Qemu, VirtualBox, VMWare etc.), JavaScript, NaCl, and other examples, it seems clear that this is a problem we now know how to manage.
> you have locked yourself into a single hardware architecture with (presumably) a single API for those binaries to run against
NaCl appears to have a grip on this problem. Write portable code in one of several languages supported by LLVM; compile with LLVM to the native NaCl format that exists for various CPU architectures, and to Portable NaCl ("PNaCl") bytecode. LLVM can be replaced by another compiler that targets NaCl.
> In a world where x86 coexists with ARM, PPC-derivatives and the occasional MIPS machine (not to mention dozens of other variations) native executables are not a sensible option unless you pass that buck to the server and have it spin off a custom binary for any client that may come along.
All the server really needs to do is to pre-compile (or be given) a set of NaCl binaries for the presently popular archs as well as a PNaCl bytecode executable for everyone else, but yes indeed, it might also dynamically compile native binaries for minority archs it knows how to support in response to client demand. If the compile is too slow to serve the first such request with a native binary, then the server can serve the PNaCl code until the new native code is ready.
(As a matter of fact, it wouldn't really be necessary to replace every single HTML file with executables. But that's another story.)
> Even if you expect these things to run on metal you need a standard hardware configuration that exposes known I/O devices, etc.
It seems that NaCl provides a syscall-like interface with its "service runtime". Something similar could surely be created for a runtime based on hardware VMs (in other words, something like Ethernet emulation in implementation terms but with an API more suitable for a Web-browser plugin).
This part of the design is a weak spot of course, as it can break and fork and version and vary across implementations, but compared to the sinking sands of the browser interface it should prove much smaller and more stable. (HTML files which are genuinely documents rather than webapps are relatively robust against some API breakage but, again, it wouldn't actually be necessary to turn every HTML document with an executable blob.)
> Ok, ok- so we use a VM that everyone agrees on and- wait, we're back where we started, aren't we? Except, of course, we have a ton of mandatory overhead because browsers are no longer specialized to deal with the kinds of media users expect in a browsing experience.
Portable C or C++ compiled to NaCl should be decently fast for almost all purposes. Failing that, there's always the possibility of hand-writing raw NaCl code as an optimisation for popular architectures. (Or writing 100% native assembler if hardware virtualisation is being used instead of NaCl.) Failing that, even if a few high-performance AV formats have to be hardwired into the browser alongside WebGL (or whatever), we're still nowhere near being back where we are - in a madhouse world where a cartel of browser vendors empowers a tin-pot Napoleon to dictate, among many other things, how we will all mark up our documents, down to the minutest details.
edit: http://www.systemtoolbox.com/bfarticle.php?content_id=6
Monty: The previous Ogg generation, Stormbringer, was a "meta-codec", a language and virtual machine for writing other codecs. It turns out very few people at the time were interested; they didn't want meta-codecs, they wanted the codecs themselves. A particularly abysmal demo of Stormbringer at Apple finally drove that point home (in addition to the fact that Apple was uninterested in Stormbringer, which needed more work to be practically useful, our demo laptop decided to overheat and break down in the middle of our pitch to the Quicktime group). That took our sense of direction away for a while; for most of 1998, no one worked on anything related to Ogg.
Then in the fall, Fraunhofer decided to start cracking down on free encoder implementations of mp3. That worried me. It also seemed like things were only likely to get worse; the trend was clearly for companies to start "cashing in" on the Net any way possible, often involving the basic technology itself, and it looked like digital audio would be no different. In 1998 this sense of foreboding was mostly a vague suspicion, but the trend strengthened and clarified over time. That gave me a clear direction to begin Vorbis; I knew what the world was going to need in a codec and soon.
The primary feature of declarative protocols/formats/languages is to convey a common meaning of data without specifying how it should be interpreted. Try to pull meaning out of imperative code and you'll run up against the halting problem. We could just be happy with our binary blobs, but moving beyond take-it-or-leave-it single-purpose content is exactly what as allowed "the web" the flourish.
Programmable logic as a standard PC feature would be great, but there would still be video ASICs for low power decoding or high-quality realtime encoding. also how would you propose to set a standard format for FPGA bitstreams when the balance of topology/block capability/timing is ever-changing. Once again we'd need a common declarative format as a base, and software tailored for the different nodes.
If I've got a "page" that displays an image, how is the code to display that image specified? In lisp terminology, does that reference involve a relatively opaque gensym that is bound (by the page) to the code to interpret it? Or does the page instead include a well-known semantically meaningful unbound symbol, which is then interpreted by my software stack as referencing code that is administered by my package manager?
There's certainly a continuum between the two, but everything in the OP strikes me as arguing for the opaque and locally bound symbol, at the expense of control by the end-user.
Here's a quick-and-dirty outline of how it could work. The webclient has a local map of file associations from a given file type to a generic-runtime display program for files of that type, specified by a URL (or maybe a URI). When the webclient has to determine the default display program for a particular file it is loading, it first looks up the local table. (Obviously the default action for a file which is itself a generic-runtime executable is to run it directly.) If there's no local mapping for the file's filetype then, for that loading sequence only, the webclient takes as the default the display program suggested (again using a URL/URI) by the file's webserver in the response header.
Of course display programs can be cached locally. There's also no assumption that the default display program will always be the one used - on any given occasion that a file is loaded, the user (or a default-runtime program which is XHRing the file) can specify a non-default display program, in order to get a different UI or a non-standard view or just a different display-program implementation. (And a program doing an XHR could just take the file itself if it desires.) Finally, the process can chain, so a particular file might be given to a display program which is a Ruby script which would in turn be given to a generic-runtime interpreter for the appropriate version of Ruby.
> There's certainly a continuum between the two, but everything in the OP strikes me as arguing for the opaque and locally bound symbol, at the expense of control by the end-user.
Yes, the OP is basically advocating Alan Kay's floor-wax over TBL's dessert topping. But talking about a continuum implies that I'm hawking some horrible compromise substance made by mixing floor-wax and dessert topping in a bucket in whatever ratio. In fact, I'm offering a delicious synthesis product which really is a perfect specimen of both things at the same time! ;) http://en.wikipedia.org/wiki/List_of_Saturday_Night_Live_com...
http://web.archive.org/web/20050414203105/http://ce.et.tudel...
If one was to flesh this idea out and create a "universal bitstream" -> specific FPGA "compiler", at what layer do we stop and declare that we have reached the proper primitive abstractions? What happens when technology moves on from those primitives, and more performance is demanded by the majority of the applications? An older CPU can go about its business a bit slower while an older FPGA trying to run new code won't even fit the design.
I work for a company writing its own video codecs, who have a format that downloads a 70KB jar file before streaming the video. It's a Java applet (and still supports Java 1.1 - we've been doing this for a number of years now) and largely allows the model that Stanislav wishes. Is it ideal? Probably not. We can't do fullscreen or hardware-optimised playback. We have to implement our own controls that are out of place of the L&F of the OS and browser. We need people to install the Java VM. On Java versions older than JDK6u18 we still only get to use 64MB of memory (on a 2GB machine? Hah!). Not always going to work on your latest smartphone.
On the flip side, I also see a lot of video container formats where people try to standardise something as generic as possible. Particularly OMFI (Bento), Quicktime, AAF. The simplest AAF File which simple refers to a piece of video content elsewhere is 250KB, because it has to define a complete vocabulary of items that it might deal with in the file, and jumps from pointer to pointer to actually get to the data. It's pretty much the closest we have to Stanislav's 1961 Air Force quote example, with everything short of actually including a decoder specification for the audio and video content. It's a minefield to work with. It's too flexible for its own good, and reading or writing it is anything but a trivial task (cue large libraries, larger than video decoders, to do that. Anything but ideal).
So, one side involves a virtual machine to standardise hardware, and the other needs large libraries to parse and emit even the simplest of files. I've seen this world, and I think I'd rather have well-implemented standard decoders working on simpler wrappers instead.
Formats exist so that programs can make good assumptions based on content. Given a good format, the content can be transformed or fitted to the device - for example, web pages on smartphones vs computers.
Also, given a format, the programmer is freed to make performance enhancements that aren't dictated by a specific platform or set of technologies. Want to write a CSV parer in Ruby? Go right ahead! Need to rewrite it in assembler for speed? Sure! You can't easily do that with a closed platform/tech like Flash or MS's binary formats.
Pass the pipe, please!
The author points to Alan Kay's anecdote about a simple, standardized way for formatting data on cards in 1961 and then immediately turns around and uses it to argue that standardized formats do not improve interoperability. Sounds hypocritical to me.
> "I liken starting one's computing career with Unix, say as an undergraduate, to being born in East Africa. It is intolerably hot, your body is covered with lice and flies, you are malnourished and you suffer from numerous curable diseases. But, as far as young East Africans can tell, this is simply the natural condition and they live within it. By the time they find out differently, it is too late. They already think that the writing of shell scripts is a natural act."
> Ken Pier, Xerox PARC
but while that jab illustrates the Everything Is Fine; Nothing Can Be Done mentality in computing very clearly, it's probably unfairly disrespectful to East African people.
Fast JavaScript could go a long way in that direction too https://github.com/antimatter15/weppy With types and WebGL hardware access who knows.
NaCl project has social forces going against it. People want a homogenous platform. Platforms solve a social problem, developers become familiar with the same API, make libraries for it, make development easier, etc.. NaCl would have to play that game and it takes a long time. By the time it's done it won't be a good fit for problems of the day, just like high level VMs today.
e2: I give up; HN just won't let me post the whole thing. I've moved this comment to a pastebin, at < http://pastebin.com/bVn91ApU >
If you read my "laws of computing" piece:
http://www.loper-os.org/?p=284
do you still believe this?
For the impatient: I advocate a switch to direct hardware execution of exclusively high-level (human readable!) code. Does it get more user-modifiable than that? I'd like to know.
What sort of code the hardware executes is irrelevant to whether that code is Free. JavaScript is high-level and mostly human-readable, but it's trivial to obfuscate JavaScript such that modification by the user is difficult or impossible. And JavaScript is a relatively limited language; a LISP-like language executed directly by the hardware could be even more difficult to modify.
This is a moral, rather than technological problem. Anyone writing any kind of code can choose to make life less-pleasant for those who will read it.
Under current architectures, you do not even have the option of making life pleasant for those who wish to read the code that is presently running on their machine, at the time it runs. In fact, the very idea sounds like schizophrenic soapbox heresy to most people. Which is a crying shame.
We can mitigate most of these issues with cryptographic identities and trust systems, but with that amount of surrounding infrastructure, why does the datasource even need to specify which code to run for well-known datatypes if those packages already have to be on my trusted sources?
But if I were to write such a comment, it would, in a sense, be the code. Not that I wouldn't love to post the latter, when it is ready, but this is not the intended use of this site.
My apologies if this sounds like a slick excuse, but it is the truth.
I'm not sure X would be my prime example of simplicity...