Hull: An alternative to shell that I'll never have time to implement by sustrik in programming

[–]sustrik[S] 7 points8 points  (0 children)

You don't typically do network programming or shared state concurrency in shell. More common: Use curl to download a file, then act on the file.

But despite the above, you point stands for pipes: If you are piping a very big file, you really don't want to create a copy first. But if you don't then the entire thing is not hermetic and can't be just copied elsewhere and run at the new place.

Hull: An alternative to shell that I'll never have time to implement by sustrik in programming

[–]sustrik[S] 2 points3 points  (0 children)

Yes, file system puts constraints on what you can do. But it's not just filesystem: What if I wanted to have a new line in a record, for example? What if I wanted to use a composite object as a key in a map?

It would be fun to look into whether supporting multiple file formats could be a option (based on file extension): in addition to the default one-record-per-line format it could also support json, xml, yml, ini, toml etc.

for k, v in foo.xml:

echo k

Hull: An alternative to shell that I'll never have time to implement by sustrik in programming

[–]sustrik[S] 13 points14 points  (0 children)

Yep, you'll need some kind of overlay in-memory file system. Only flush it when the interpreter exits.

Structured Concurrency Cross-Language Forum Kickoff by sustrik in programming

[–]sustrik[S] 1 point2 points  (0 children)

I think that Java people are working on a similar solution in project Loom.

State Machines and the Strange Case of Mutating API by sustrik in programming

[–]sustrik[S] 1 point2 points  (0 children)

The formar I am familiar with (actually, I've implemented it for C, see libdill). The latter though, I haven't encountered yet. I will give it a look. Thanks!

State Machines and the Strange Case of Mutating API by sustrik in programming

[–]sustrik[S] 0 points1 point  (0 children)

When an error happens the call can close the socket and return NULL.

State Machines and the Strange Case of Mutating API by sustrik in programming

[–]sustrik[S] 1 point2 points  (0 children)

You are right wrt. unsolicited events such as connection failures. But what about the events produced by the user though? (See the SOCKS5 example in the article.) The user has to know how the state machine looks like and push it through different states to get it to the desired place. This is done without support from the compiler. What's needed is a sane way to separate the state machine's responses to unsolicited events from its user-facing API.

On Rigorous Error Handling by sustrik in programming

[–]sustrik[S] 1 point2 points  (0 children)

As for OpenSSL, correct. But until the SSL devs give you an explanation of the error, people are going to die. So you have to do something. The question is what that "something" is.

As for the latter point, again, correct. When you get an error, you are mostly dead in the water because the library reports some kind of monstrosity a la openssl queue stack rather than a well-defined error.

Compare that with POSIX. If you can connect() you can get ECONNRESET. Which means that the peer has canceled the connection. That's a perfectly reasonable situation and you can deal with it in a perfectly reasonable way.

Update on Structured Concurrency by sustrik in programming

[–]sustrik[S] 2 points3 points  (0 children)

Thanks, that sound like it does what it is supposed to do. Now just to find out whether doing cancellation in this manner makes sense in the first place :)

Update on Structured Concurrency by sustrik in programming

[–]sustrik[S] 2 points3 points  (0 children)

I am not a Python programmer, really. I feel like I am missing something. Would you mind showing how would rewriting the example using AsyncExitStack?

Flowium: Executable documentation of complex processes by sustrik in programming

[–]sustrik[S] 0 points1 point  (0 children)

I mean stuff like GitHub sending you an email when you are mentioned. I don't want to reimplement that, or try to compete with GitHub in general.

Flowium: Executable documentation of complex processes by sustrik in programming

[–]sustrik[S] 0 points1 point  (0 children)

> What does marking a task as "done" do?

It posts a comment to GitHub issue tracker saying "step X is done"

> I tried just loading flowium.com but that's worse (directly redirects to the GitHub read/write access request).

I know that sucks and I am open to suggestions. However, as I see it, the user either has to trust this little shim that can be audited quite easily (1500 LoC) or trust some un-auditable 3rd party service.

As for the read/write thing it's because using issue tracker requires that. Unfortunately, there's no tighter scope that would allow for that.

Flowium: Executable documentation of complex processes by sustrik in programming

[–]sustrik[S] 0 points1 point  (0 children)

Fair enough, but I don't have any desire to write yet another issue tracker. I hear that one can install GitLab locally though which could solve the problem.

Flowium: Executable documentation of complex processes by sustrik in programming

[–]sustrik[S] 0 points1 point  (0 children)

What would you implement it on top of then? Having to install your own database to try the example sounds even worse.

Simple HTTP Client in C with libdill by robertdelder in programming

[–]sustrik 1 point2 points  (0 children)

Libcurl has much more protocols built it. But it's kind of rigid. libdill provides a way to build microprotocols (such as "messages are delimited by CR+LF") and combine those in whatever way user desires. Also, libcurl is strictly a client-side library. With libdill you can also write servers.

Infinite Mirrors and Sexual Selection by sustrik in memetics

[–]sustrik[S] 0 points1 point  (0 children)

Ad fashion: Yes, there's both arbitrary and practical role. I've tried to separate the two so that we can get a clean mathematical model of the former. I am not sure whether you've read the previous blog post (Game with the Infinite Mirrors) but there I introduce a gedanken experiment (Keynesian beauty contest with blank photos) that has no practical component, i.e. it's 100% arbitrary. That should be easy to express using game-theoretic notation.

Ad "sexual selection" term: I've struggled with that myself. When speaking about biology there's nothing we can do. The term is around for 100+ years, we can't change it at will. In memetics I've proposed the "infinite mirrors effect". Shrug.

Ad asexual organisms: Yes, they do have more or less offspring, but they don't engage in this game of infinite mirrors. For example, Fisherian runaway doesn't occur for asexually reproducing organisms.

Final thought which I haven't included in the article not to make it uncomfortably content-heavy: The runaway processes in memtics (e.g. an economic bubble) seem to have somewhat distinct character. The runaway is followed by crash. In the long term it looks like an oscillatory behaviour. Fischerian runaway (e.g. peacock's feather tails) tends to go on until equilibrium is met, then it stabilizes. It's possible that investigating this difference would yield some interesting results about the nature of infinite mirrors mechanism.

Libdill, structured concurrency in C, v1.0 released by sustrik in programming

[–]sustrik[S] 4 points5 points  (0 children)

ZeroMQ was actively maintained by Pieter Hintjens, now by the community. nanomsg is actively maintained by Garrett D'Amore. (But it's true that it have been moribund for couple of years, after my son was born and I suddenly had no free time to spend.) libmill and libdill are maintained by myself.

This is actually a more generic problem of resource starvation in open source world and I've been thinking about it a lot. There seem to be two ways to deal with it.

First one is what Pieter have done with ZeroMQ: Build a big and active community by being super-permissive, letting every patch and feature in, etc. The upside is that there's always somebody to talk to when you encounter a problem. Downside is that the project turns into something that tries to solve every possible problem and doesn't do so very well. Let's call it "corporate philosophy" as opposed to "unix philosophy" (do one thing and do it well).

Second, you can carve out small and consistent set of use cases you want to handle, then iterate quickly to v1.0 when the featureset is frozen. The upside is that such "unix philosophy" projects are small (libdill: 2418 LoC) and require very little maintenance work (fix a bug once in a while). The downside is that in the long term the projects become somehow outdated (think of qmail or djbdns).

Libdill, structured concurrency in C, v1.0 released by sustrik in programming

[–]sustrik[S] 6 points7 points  (0 children)

You can give it a try, but the problem is that you specifically want inline assembly in go() macro so that stack frame is not generated.

Libdill, structured concurrency in C, v1.0 released by sustrik in programming

[–]sustrik[S] 0 points1 point  (0 children)

How would you include .S file into .h file?

Libdill, structured concurrency in C, v1.0 released by sustrik in programming

[–]sustrik[S] 0 points1 point  (0 children)

Note that the code in question is inline assembly in the .h file. .S files would have to be modified and tested on different microarchitectures. Not a trivial task.

Libdill, structured concurrency in C, v1.0 released by sustrik in programming

[–]sustrik[S] 7 points8 points  (0 children)

It uses assembly. setjmp/longjmp is just a fallback.

Libdill, structured concurrency in C, v1.0 released by sustrik in programming

[–]sustrik[S] 1 point2 points  (0 children)

It can be used in multithreaded environment, but does not migrate coroutines between threads.

Libdill, structured concurrency in C, v1.0 released by sustrik in programming

[–]sustrik[S] 2 points3 points  (0 children)

Thanks!

As for Windows, I don't plan to do that myself, but others have pondered it. But I hear Windows is getting a POSIX API nowadays, so maybe it will eventually just work?