Re:Libdill: Structured Concurrency for C (2016)
by igravious on Thursday December 21, 2017 @11:32AM
(#15980163)
I like the idea of structured tree-like concurrency, fits my brains.
About your API though.
Why is there a load of inet/ip/socket functions, shouldn't they be in a separate lib? Why is the opposite of the fn int go(expr) the fn int hclose(int) and not the fn int stop(int) or something like it. open/close – go/stop – and so on …
Re:Libdill: Structured Concurrency for C (2016)
by rumcajz on Thursday December 21, 2017 @11:37AM
(#15980229)
The socket functions were once in a separate library but it's just easier to use like this. Linking with 1 library, not having to care about version mismatches etc.
My recommendation would be to just not use the socket functions and link with the library stitically. That way the unused code will be discarded.
As for hclose() that was just mimicking the POSIX close() function.
I am not 100% sure about the structured concurrency concept myself, but comparing it to structured programming feels reassuring. Basically, a tree structure (whether a syntactic tree or the tree of running coroutines) is probably the most complex way to structuring stuff that's still tractable by a human being. Once you go beyond that, you'll eventually get lost. Thus, tools enforcing a tree-like structure are likely to be helpful to keep the program maintainable.