phlog

Source code for my blog/gemlog. It used to be on gopher, hence the name
git clone http://shtanton.xyz/git/repo/phlog
Log | Files | Refs

commit 150ee3e8084ed2e657b789094aa4baeec0efffdc
parent a6d5c0553351b671453a15e9558cf64c9b9a2d9b
Author: Charlie Stanton <charlie@shtanton.xyz>
Date:   Wed,  8 Sep 2021 10:10:13 +0100

Further write the piping post

Diffstat:
Mposts/better_than_stdio.gmi | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/posts/better_than_stdio.gmi b/posts/better_than_stdio.gmi @@ -2,9 +2,9 @@ I was writing a post where I would design a language that would be better than t My gripes with pipes in the shell were as follows: - Only for passing string data delimited by newlines. -- Can't do cyclical data passing. -- Data streams can't be combined or duplicated. - Each process only has 1 input and output stream (stdin and stdout). +- Data streams can't be combined or duplicated. +- Can't do cyclical data passing. - Only supports message passing style i.e. no shared memory or semaphores. I will now dissect and destroy my own arguments against the shell, hopefully saving you the effort of designing a DSL and then scrapping it like I did. @@ -83,6 +83,13 @@ struct Person { Which can be compiled and run to output "Charlie Stanton" even though the data passed through the pipe wasn't a string! Just because basically every Unix utility uses string and splits the data by line when reading it, it doesn't mean we have to. There's no reason why we can't use the pipe for a live video/audio stream, cap'n proto, data coming from some input device or anything else we want. Strings separated by newlines is quite a strong convention, but I think it's safe to completely ignore when convenient. +## Multiple input and output streams to/from a process + + + +## Combining and duplicating data streams + + ## Cyclical data passing -Suppose I want the output of one process feeding into the input of another and vice versa. Perhaps my irc bot is both receiving and sending messages through my irc client. I wasn't able to find a perfect solution to this, but we have a very good friend called the FIFO who can help us out greatly. +Suppose I want the output of one process feeding into the input of another and vice versa. Perhaps my irc bot is both receiving and sending messages through my irc client. I wasn't able to find a perfect solution to this, but we have a very good friend called the FIFO who can help us out greatly. A really simple example is a script to replace the yes utility, which outputs a string to stdout repeatedly until terminated. We could design a similar script using tee, which takes input from stdin and outputs it to stdout as well as to any files provided as arguments.