| Deutsch English Français Italiano |
|
<20241122160540.00001d69@yahoo.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.lang.c Subject: Re: logically weird loop Date: Fri, 22 Nov 2024 16:05:40 +0200 Organization: A noiseless patient Spider Lines: 71 Message-ID: <20241122160540.00001d69@yahoo.com> References: <0e1c6d2e74d44a715bf7625ca2df022d169f878a@i2pn2.org> <vhl32r$66a2$1@dont-email.me> <vhlspv$ahc9$10@dont-email.me> <vhmilk$hd28$1@dont-email.me> <vhohqf$rq03$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Date: Fri, 22 Nov 2024 15:05:45 +0100 (CET) Injection-Info: dont-email.me; posting-host="fc983d32214bfe609ed82896136f7836"; logging-data="1264225"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yRL53vo6cF7wvaIsNe8aGp4oHtHJkXz4=" Cancel-Lock: sha1:woUGMbHbbqx2zL0oaRBwOmj/3TQ= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32) Bytes: 4160 On Fri, 22 Nov 2024 00:04:32 -0000 (UTC) Lawrence D'Oliveiro <ldo@nz.invalid> wrote: > On Thu, 21 Nov 2024 07:06:43 +0100, Janis Papanagnou wrote: >=20 > > Actually, if you know Simula, coroutines are inherent part of that > > language, and they based their yet more advanced process-oriented > > model on these. I find it amazing what Simula provided (in 1967!) > > to support such things. Object orientation[*], coroutines, etc., > > all fit together, powerful, and in a neat syntactical form. =20 >=20 > Wirth did include coroutines in Modula-2. And a kind of object > orientation in Oberon, I think it was. >=20 > But these are (nowadays) called =E2=80=9Cstackful=E2=80=9D coroutines -- = because a > control transfer to another coroutine can happen at any routine call, > each coroutine context needs a full-sized stack, just like a thread. >=20 > There is this newer concept of =E2=80=9Cstackless=E2=80=9D coroutines -- = not that > they have no stack, but they need less of it, since a control > transfer to another coroutine context can only happen at the point of > an =E2=80=9Cawait=E2=80=9D construct, and these are only allowed in corou= tine > functions, which are declared =E2=80=9Casync=E2=80=9D. I think Microsoft = pioneered > this in C=E2=99=AF, but it has since been copied into JavaScript, Python = and > other languages. >=20 By chance, few days ago I was writing a small GUI panel to present a status from the hardware board we just finished building. In C#, because despite me knowing C++ (at least "old" C++) 10 times better than I know C#, building simple GUI in C# still takes me less time and the result tends to look better. It was the first time I was doing UDP in .Net and going through docs I encountered UdpClient.ReceiveAsync method. Got excited thinking that's exactly what I need to wait for response from my board while still keeping GUI responsive. But it was not obvious what exactly this async/await business is about. Read several articles, including one quite long. https://devblogs.microsoft.com/dotnet/how-async-await-really-works More I read, less I understood how it helps me and what's the point. In particular, handling timeout scenario looked especially ugly. 5-10 hours of reading were 5-12 hours wasted most unproductively. At the end, just did it good old way by ThreadPool.QueueUserWorkItem() with everything done synchronously by separate thread. Took me, may be, two hours, including wrapping my head around Control.BeginInvoke and Control.Invoke. So much for innovations. > Yes, Simula pioneered OO. But the concept has gone in different > directions since then. For example, multiple inheritance, metaclasses > and classes as objects -- all things that Python supports. What I read seems to suggest that Smalltalk had bigger influence on modern twists of OOP. But then, may be Simula influenced Smalltalk? Anyway, I don't like OOP very much, esp. so the version of it that was pushed down our throats in late 80s and early 90s.