Live data from Hacker News

Reaching the Unix philosophy's logical extreme with WebAssembly

xeiaso.net

21–30 of 142 posts

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#21
post #20
post #10

Earlier quoted context omitted.

Wasi co-chair and Wasmtime maintainer here: we agree! Wasi Preview 1, which this article is about, was a first attempt at porting some of these Unix ideas to Wasm. We found pretty quickly that unix isn't the right abstraction for Wasm. Not only is it not really portable to platforms like Windows without reinventing a compatibility layer like cygwin, it also doesn't really make sense in a Web embedding, where users en…

Have you looked at capabilities, like E, Mont-E and its descendants? https://en.wikipedia.org/wiki/Object-capability_model https://monte.readthedocs.io/en/latest/taste.html#cooperatio... https://en.wikipedia.org/wiki/E_(programming_language)

Yes, CM resources are unforgable references.

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#22

Everything is not a file. There are files and file-contents. The content of a file is not a file. The magic trick happens with #SheBang because that tells you who should interpret and execute the file-contents. That is "magic" because in a sense you must read (part of the content) to know how the contents which is just 0s and 1s should be interpreted.

> Everything is not a file.

A file is a collection of data, which usually has an associated identifier (filename and/or path). A USB mouse drive is not a file, but it can be represented as such.

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#23

Everything is not a file. There are files and file-contents. The content of a file is not a file. The magic trick happens with #SheBang because that tells you who should interpret and execute the file-contents. That is "magic" because in a sense you must read (part of the content) to know how the contents which is just 0s and 1s should be interpreted.

There are two dimensions to "everything is a file". The first is the concept of a hierarchical filesystem namespace. The second is the notion that read and write can be used as a universal interface to any resource from the perspective of the runtime environment (e.g. kernel). People focus myopically on the first aspect, but it's really the second that is the most important and most enduring.

The word "file" is ambiguous, and was used ambiguously in Unix documentation and papers. It of course meant an object with a name in the filesystem. But it also can refer to an object (whether or not existing on or even referenced by the filesystem) which is accessed using read/write, independent of how you acquired the reference (i.e. file descriptor) to that object. If you look at the whole of the Unix system, read/write over file descriptors is the backbone of the environment; process inheritance, shell redirection... much of the time a program has no idea how a resource reference was acquired, just that it can be accessed using read/write.

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#24
post #10

Earlier quoted context omitted.

Wasi co-chair and Wasmtime maintainer here: we agree! Wasi Preview 1, which this article is about, was a first attempt at porting some of these Unix ideas to Wasm. We found pretty quickly that unix isn't the right abstraction for Wasm. Not only is it not really portable to platforms like Windows without reinventing a compatibility layer like cygwin, it also doesn't really make sense in a Web embedding, where users en…

Nothing like reinventing COM :)

“COM but you can actually implement it from the docs” is surprisingly compelling, honestly. There is just an absurd number of obscure corners in the original, from DCE RPC all the way to the highest levels (although those are not the only source of COM grief—IDispatch is an abomination; IStream is needlessly annoying; IMarshal is awful to use but at the same time I don’t think actually has a convincing equivalent elsewhere; etc.).

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#25
post #12

The UNIX philosophy’s logical extreme is the NAND gate. Does one thing, does it well, and can be composed into arbitrary applications.

One thing? It does a logical and and then negates the result. The shell doesn’t really let users compose commands this way, but

  alias NAND="AND | NEG"
Also, a NAND command would need to have 2 stdin’s.

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#26
post #10

Earlier quoted context omitted.

Wasi co-chair and Wasmtime maintainer here: we agree! Wasi Preview 1, which this article is about, was a first attempt at porting some of these Unix ideas to Wasm. We found pretty quickly that unix isn't the right abstraction for Wasm. Not only is it not really portable to platforms like Windows without reinventing a compatibility layer like cygwin, it also doesn't really make sense in a Web embedding, where users en…

Nothing like reinventing COM :)

Streams sounds more like DrawBridge!

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#27
post #13

Earlier quoted context omitted.

Only if the NAND gate is expressed as a file

Okay… please… someone implement ‘nand’ and write a script that does something simple using only it.

Sure! Here's an implementation of nand and a 2-bit adder that uses it: https://github.com/jewel/nand

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#28
post #27

Earlier quoted context omitted.

Okay… please… someone implement ‘nand’ and write a script that does something simple using only it.

Sure! Here's an implementation of nand and a 2-bit adder that uses it: https://github.com/jewel/nand

Hah this is awesome!

I’m going to poke around and see how much it would take to stretch this into a basic Turing machine emulator.

Re: Reaching the Unix philosophy's logical extreme with WebAssembly

#30
I wonder if we can reliably expect React-in-Rust framework that compiles to wasm instead of js? Or maybe just a React library written in Rust, but you can still write the source code in javascript?

Or maybe at least Typescript-to-WASM compiler to skip JS output?

Post reply on HN