Live data from Hacker News

Reaching the Unix philosophy's logical extreme with WebAssembly

xeiaso.net

81–90 of 142 posts

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

#81

The Unix Philosophy: A) Tasks should done by combinations of simple tools combined into an elegant pipe. B) Each tools should do three things, one of them at least so-so well: Those three are: 1) Hackily parse the output of the previous tool by flaky assumptions like that a certain delimiter is always present, that spaces will not occur in such and such an item, or that such and such a field is from this column to th…

That's a very twisted definition of Unix.

1) This is not done by every tool. Instead, there are tools built for specific parsing purposes, and each tool is only in charge of interpreting its command-line arguments or, optionally, stdin in some suitable way. Tools are agnostic of the output of previous tools, and only care about processing data that makes sense to them. It's the task of the user to ensure this data is structured correctly.

2) Where are you getting these limits? Shell limits can be controlled by ulimit(1p), but the standard file descriptors function as unlimited streams of data.

3) Again, every process is free to choose the best way to output data. Some have flags that make processing the output easier by another tool, otherwise they default to what makes sense for the user.

You seem to have a bone to pick with the fact that the data shared between processes is unstructured, and that the user must handle this on their own, but this is what enables building independent tools that "do one thing well", yet are still able to work together. Sure, in a tightly controlled environment, tools can share structured data (e.g. objects in PowerShell, JSON in NuShell, Murex, etc.), but this comes at the expense of added complexity, since each tool needs to handle this specific format, encoding, etc. This is difficult to coordinate and scale, and arguably the rich Unix ecosystem wouldn't exist if some arcane format was chosen 40+ years ago, or if a new one needs to be supported whenever something "better" than JSON comes along. Leaving the data unstructured and up to each process and user to handle, ensures both past and future compatibility.

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

#82
post #72

Earlier quoted context omitted.

Right, the person I asked is claiming that NAND is two things. You appear to have responded as if you disagree with my comment while not actually disagreeing with any part of it. What did you think I meant by this question? >> In what conceivable sense is "doing a logical and " one thing while "doing a logical nand " isn't?

Sorry, I will try to make it more clear. NAND is more complex than AND, in the sense that it is more expressive than AND (having functional completeness which AND does not). Similarly, it can be built from other less complex operators (AND and NAND). If you're taking "One thing" to the extreme, in terms of the granularity or complexity of that "one thing", NAND is not as granular or simple as AND - and therefore isn'…

What's the argument that AND is less complex than NAND? It's true that NAND has completeness and AND doesn't, but so what? What you can build from something is not a measure of how complex it is. You measure complexity in terms of what it takes to describe something.

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

#83
post #72

Earlier quoted context omitted.

Sorry, I will try to make it more clear. NAND is more complex than AND, in the sense that it is more expressive than AND (having functional completeness which AND does not). Similarly, it can be built from other less complex operators (AND and NAND). If you're taking "One thing" to the extreme, in terms of the granularity or complexity of that "one thing", NAND is not as granular or simple as AND - and therefore isn'…

What's the argument that AND is less complex than NAND? It's true that NAND has completeness and AND doesn't, but so what? What you can build from something is not a measure of how complex it is. You measure complexity in terms of what it takes to describe something.

It seems naively obvious to me that a(b(x)) is more complex than b(x). Practically tautology.

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

#84
post #64

Reminds me of that time I wrote a StringToExecutableFile() function for running [e.g. a Rust binary] from C++, but that depended on several layers of build system horror to embed the executable file as a string, and it wasn't cross-platform. Imagine a utility function that dumps an embedded string to an unlinked temporary file, sets the +x permission, and returns a /proc/self/fd/N filename so you can exec() a subproc…

This is of course not the purpose of your post, but since you're interested in this topic, I wanted to mention that you can now create memory-backed files on linux using the memfd_create syscall without using any filesystem (nor unlink) and you can also execute them without the /proc/self/fd trick by using the execveat syscall. In glibc, there is fexecve which uses execveat or falls back to the /proc trick on older k…

Looks like memfd_create is from Linux 3.17 (2014), which was after I wrote the function. I sort of miss the days when simple stuff was hard.

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

#85
post #81

The Unix Philosophy: A) Tasks should done by combinations of simple tools combined into an elegant pipe. B) Each tools should do three things, one of them at least so-so well: Those three are: 1) Hackily parse the output of the previous tool by flaky assumptions like that a certain delimiter is always present, that spaces will not occur in such and such an item, or that such and such a field is from this column to th…

That's a very twisted definition of Unix. 1) This is not done by every tool. Instead, there are tools built for specific parsing purposes, and each tool is only in charge of interpreting its command-line arguments or, optionally, stdin in some suitable way. Tools are agnostic of the output of previous tools, and only care about processing data that makes sense to them. It's the task of the user to ensure this data is…

What if the format chosen 40+ years ago wasn't arcane, and arguably you could avoid the legitimate mess of parsing poorly structured data for 40+ years?

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

#86

The pipeline pattern has its uses, but it's not the most important (or even the most well known?) tenant of the Unix philosophy. It's "Everything is a File"[0]. That one has really stood the test of time. And it's often misunderstood to mean that everything implements {Read,Write,Seek,Truncate, etc.}. Then when a TCP socket or character device or whatever shows up, the whole abstraction leaks, and it seems like not e…

[deleted]

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

#87
post #86

The pipeline pattern has its uses, but it's not the most important (or even the most well known?) tenant of the Unix philosophy. It's "Everything is a File"[0]. That one has really stood the test of time. And it's often misunderstood to mean that everything implements {Read,Write,Seek,Truncate, etc.}. Then when a TCP socket or character device or whatever shows up, the whole abstraction leaks, and it seems like not e…

[deleted]

[deleted]

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

#88
post #68
post #57

Earlier quoted context omitted.

This looks more than a bit like the Inferno OS, created by some of the same folks who created Unix. WASM allows to distribute cross-platform binary code written in memory-safe Rust, running on pretty compact VM. Think about a plugin architecture that could be built on top of that.

Java (like mentioned in the article) does the same though IIRC Inferno OS is like Java in this regard. How will WASM change what Java has already done? Why would I compile Rust to WASM when I can compile Rust natively to any number of platforms? And use FFI? I think WASM, while nice, doesn't bring much new to the table. It's been hyped for years, and I still only see it used here and there very sparingly.

This is how.

The installed size of OpenJDK 17 JRE on my machine is 186MB, according to the package manager.

I suspect that the WASM VM embedded in the program demonstrated in the blog post is 1.5 to 2 orders of magnitude smaller.

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

#89
post #4

Wasn't there some kind of components proposal that would let modules written in different languages running in web assembly interop with each other? WASI is great but there was an opportunity to standardize on something much more powerful. Anyway I think the logical extreme of Unix philosophy started with Unix, moved on to Plan 9, and continued to improve from there. It's just that those further advancements are less…

[deleted]

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

#90

The pipeline pattern has its uses, but it's not the most important (or even the most well known?) tenant of the Unix philosophy. It's "Everything is a File"[0]. That one has really stood the test of time. And it's often misunderstood to mean that everything implements {Read,Write,Seek,Truncate, etc.}. Then when a TCP socket or character device or whatever shows up, the whole abstraction leaks, and it seems like not e…

The pipeline pattern is still very useful, even if it isn't the most important or most well known tenant (I am not sure of this, but maybe you are right). Still, of course it is not perfect. "Everything is a file" has its benefits too, but also is not perfect either. However, even if not all of {Read,Write,Seek,Truncate,etc} are implemented for all objects, some of them will be implemented, e.g. a TCP socket or chara…

Sounds pretty cool. Which hardware platforms does it target (even if they are virtual)? Is there a way to run it?
Post reply on HN