🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1629

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

#1629
From: bartc
Date: Wed, 18 Nov 2026 13:18
117 lines
7404 bytes
On 18/11/2026 12:13, Ross Finlayson wrote:
> On 11/13/2026 08:54 AM, David Brown wrote:
>> His posts are not written by AI - no AI writes that badly.  And it is
>> not so void of meaning and grammar that it is randomly generated.  Ross
>> has written posts in this style for many years in several Usenet groups.
>>   I find it hard to believe that someone would spend so much time and
>> effort for a joke.
>>
> 
> Then, in another thread, bringing it back here:
> 
>  >> Here then for example, what I'm trying to figure out is basically
>  >> how to make for C what's in C++ without being in C++ that's yet
>  >> readily adaptable for calling and being called from and into C++
>  >> from C. Like, for example, "sequence" or "iter", and "lister"
>  >> and the like, then for something like "C11 _Generic", making accounts
>  >> of generics the types in C vis-a-vis the polymorphic class model
>  >> in C++, about "sized" or accounts like "characteristics" of access
>  >> of arrays, pointer-offsets, lists, otherwise the usual things,
>  >> "holders", "getters and setters", then about "libraries" and
>  >> "components", after things like "success_t, error_t, and return_t,
>  >> for context_t", definitions of the patterns, that would be generally
>  >> suitable for writing libraries in C and having them callable and
>  >> calling to and from C++, these are the kinds of things I'm liking
>  >> to figure out.
>  >>
>  >>
>  >> Like for example about how to pass an allocator into C, or making
>  >> access of ctx_new/ctx_del or ctx_init/ctx_fini, those being about
>  >> storage or lifetime and ownership and responsibility, then for
>  >> things like "emit_log" and "emit_metric" and "emit_dump", these
>  >> are the kinds of things that later always live in any sort of
>  >> application framework, for making good-style.
>  >>
>  >
>  > Why not just write :
>  >
>  > """
>  > How do I write C++ code in C?
>  > """
>  >
>  > The answer then would be, you don't.  Write C++ code in C++.  Write C
>  > code in C.
>  >
> 
> 
> Here the points under consideration are that C++ has some relevant
> constructs that to use the same patterns in C, then to make for
> the _interoperability_, has for example that libraries of most
> any usual sort result their symbols, those being of C, or as after
> name-mangling (a convention of expressing the namespaces and constructs
> encoding the names/symbols as C defines for what C++ models,
> name-mangling, where "the mangle" is a steam-press for the ironing
> of sheets, where the common meaning is "fold, spindle, and mutilate"),
> there's that "writing C++ in C", is to make it adapt-able.

That paragraph should be taken out and shot.

Together with most other gibberish you write.

Are you asking a question here? Why are you posting this; what response 
are you after?

Or maybe you enjoy regurgitating random facts in as incomprehensible a 
manner as possible.

Or is your aim just to provoke reactions like this?

> 
> Then, other accounts involve the system, for example malloc/free,
> vis-a-vis, allocators, and that C++'s account of new/delete,
> has also an account of pretty much every constructor allowing
> the passing of an allocator, for example about free-lists/arenas/slabs,
> about how to make a _pattern_ so that either the library interface
> signature has function-pointers for acquire-release, or, for example,
> there's a convention where each process/thread has a global-variable
> (called thread-local in a thread, global to the thread) with function
> pointers for acquire/release.
> 
> It's similar with stdio, or for example loggers, usually considered
> "static" (or extern) to the process to result a global entry-point
> for the rest of the routine, or, what makes for that it gets passed
> to every library-function or installed in the context passsed to every
> library function, about what aren't "classes" and "instances" like in
> C++ which is defined in the language, _yet so model those_, why it's a
> thing.
> 
> Other examples of accounts for example make for list-adapters or
> iterators or accounts of sequences then about treating arrays and
> lists as the same (while they have different characteristics of
> access, the "access-patternry"), then for example about associative
> arrays and sets and the like then into traversals for trees and graphs
> and the like, where for example many "loosely-typed" languages of the
> day (like JavaScript, Python, ...) have that's _default_ with the
> "slots" the associative-array, vis-a-vis something like "the shell
> language" and accounts of attributes, and behaviors for arrays and
> associative-arrays, those being considered general. So, the idea is
> that something like C11 has something like "_Generic" keyword to employ,
> that instead of writing to a concrete implementation of
> an array or list, instead to write to the _adapters_ of these,
> in C, which can be more direct for C++, with C++'s great account of,
> "Abstraction", for the abstract and the concrete, and that anything's
> both abstract and concrete.
> 
> 
> C and C++ are different accounts: they're also together an account.
> Then, the resulting artifacts: has that C++ can link as it were
> to the C symbols, and even the C can link as it were to name-mangled
> C++, not that anybody ever does that since it involves the model in
> the run-time their interpretation, point being libraries to be
> interoperable with both C and C++ have C exports, then that it's
> to be expected that C++ for example can deal with the allocator
> or I/O stream, wrapping it into the C++ from a C way that must be 
> contrived.
Maybe you should write a book. It would simultaneously be useful as a 
door-stop, and a cure for insomnia.
Technical Details
Message-ID: <11dk8ib$1c198$1@dont-email.me>
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> <PKGcne0xA53EC2D3nZ2dnZfqn_udnZ2d@giganews.com>

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: bartc <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: Inversion-of-control and dependency-injection in C
Date: Wed, 18 Nov 2026 13:18:03 +0000
Organization: A noiseless patient Spider
Lines: 117
Message-ID: <11dk8ib$1c198$1@dont-email.me>
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>
 <PKGcne0xA53EC2D3nZ2dnZfqn_udnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 18 Nov 2026 13:18:04 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1443112"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/t909jUSnip0bZq+qgHB3Q"; posting-host="b7c8a39b5d7c70285aa7a76a9d5d9d96"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:debfJrCO7m13jnteRMbTpssvRwU= sha256:IIItiYURVjEkdxAm4t+NJjHCHqwE9hETDbrjYkJrDbM=
	sha1:0Ez8sQ9i0x7tAJT3ZpneHtvexds= sha256:gnbyyWzNP3S7gVRwyXcdyLjNc+eso2+nNQusWZILQUM=
In-Reply-To: <PKGcne0xA53EC2D3nZ2dnZfqn_udnZ2d@giganews.com>
Content-Language: en-GB