🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1695

Re: Inversion-of-control and dependency-injection in C

#1695
From: Michael S
Date: Fri, 20 Nov 2026 13:12
51 lines
3753 bytes
On Fri, 20 Nov 2026 12:35:25 +0000
Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk>
wrote:

> On 16/11/2026 18:09, Bonita Montero wrote:
> > Am 13.11.2026 um 23:50 schrieb Ross Finlayson:
> >   
> >> So, here's one. Say you got a server process for sockets of the
> >> connection-oriented or datagram-wise or association-oriented like
> >> TCP, UDP, or SCTP, and it manages the connecting and the sending
> >> and receiving about a million of those and is sort of fixed-size
> >> and stable in a usual runtime. So, how do you design the interface,
> >> about stuff like the state-machine of _protocols_, all about
> >> _protocols_, in the application-layer and above, say, for example
> >> the incremental-parsing and the state-machine of the protocol
> >> and sub-protocols and upgrade-protocols and the like, what sort
> >> of abstraction with suitable-defaults and reasonable-opinions
> >> makes for having any sort protocol as a composable library.  
> 
> > Use C++20 coroutines with Bost.ASIO and io_uring. This gives
> > as less code as possible with nearly optimal I/O performance.  
> 
> I like this answer.
> 
> It's funny: people used coroutines and CoEs back in the 1970s (I did
> it as a child, myself), then everyone told each other to stop it, now
> 50 years later here we are again, finally succeeding once more after
> a long hiatus, albeit with appalling syntax and semantics everywhere
> around it like thorny bushes.
> 

Not every co-routine syntax is as bad as one of C++.
C# async is better.
May be, even Rust is better, at cost on reliance on magic barely
documented tokio runtime.

Me, personally? 
I accepted the idea of language-managed stackless co-routines when heard
about it first time. But with time passing I like it less and less.
More and more I tend to think that what I really would like are
normal co-routines, a.k.a. fibers, not necessarily as part of the
language.

Or just do as golang, leaving selection between fibers and
kerner-visible threads to language runtime. Hopefully, I did not
misrepresent golang approach to badly :(




Technical Details
Message-ID: <20261120151218.00007f53@yahoo.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <yQOdnQ-qnKiiZ2j3nZ2dnZfqn_udnZ2d@giganews.com> <11d56gl$3ud5q$1@dont-email.me> <11d6vjp$qhu8$1@raubtier-asyl.eternal-september.org> <dsednTD-Fblclmr3nZ2dnZfqnPWdnZ2d@giganews.com> <11d738r$ru7a$1@dont-email.me> <11d75i7$spj0$1@dont-email.me> <11d7c8k$173nk$1@dont-email.me> <11d7fbv$1839o$2@dont-email.me> <nrecnTdvuvbACWr3nZ2dnZfqn_adnZ2d@giganews.com> <11dfgtf$3pj6i$1@raubtier-asyl.eternal-september.org> <11dpeqd$35ddj$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: Inversion-of-control and dependency-injection in C
Date: Fri, 20 Nov 2026 15:12:18 +0200
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <20261120151218.00007f53@yahoo.com>
References: <yQOdnQ-qnKiiZ2j3nZ2dnZfqn_udnZ2d@giganews.com>
	<11d56gl$3ud5q$1@dont-email.me>
	<11d6vjp$qhu8$1@raubtier-asyl.eternal-september.org>
	<dsednTD-Fblclmr3nZ2dnZfqnPWdnZ2d@giganews.com>
	<11d738r$ru7a$1@dont-email.me>
	<11d75i7$spj0$1@dont-email.me>
	<11d7c8k$173nk$1@dont-email.me>
	<11d7fbv$1839o$2@dont-email.me>
	<nrecnTdvuvbACWr3nZ2dnZfqn_adnZ2d@giganews.com>
	<11dfgtf$3pj6i$1@raubtier-asyl.eternal-september.org>
	<11dpeqd$35ddj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 20 Nov 2026 13:12:17 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2785104"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/ptJWlPOQ9E7KAhaa7eHCXXrZ1Y9J4b3U="; posting-host="c9277e243488dd36750115eaaca8b400"
Cancel-Lock: sha1:Lucn6IH8Us67Dw9UNVPQOns2RPI= sha256:jIX6Y85uZvqgLqcAyTtO6Ydes+RuKu1fzc5HxU7gQsA=
	sha1:ddPYkTNIa3DCGMe77KodPsWs4ZA= sha256:nw9OAw1dqeTWWHJXfRn9UYgb7MPyLcxu2ty02hsQ3Pk=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)