X-Forwarded-Encrypted: i=1; AJvYcCU5XnRn3wVKP+z6ktx/4Jfup3kllrQG1h+OnTU0jomome/gc1Um+xFfofyXGV3Pj2LD97BqF/OqKUWaqdKifidHMiw8oLfYsvTmw/lNl6biX0NuiX5ykQ== X-Received: by 2002:a05:622a:1209:b0:42d:fe41:4ae7 with SMTP id y9-20020a05622a120900b0042dfe414ae7mr483006qtx.7.1708474830847; Tue, 20 Feb 2024 16:20:30 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXroA7RdRnQ8MlOajWVoIl+DOQIGQHAfTrHWzaO1A38JhxAiZXz7z/XLIZooLwlPeh7qG+vUoEumpXFsng69SHlG+nYz8yuSSeJx+SyeABN4lAt+itoaw== X-Received: by 2002:a05:6870:819a:b0:21e:9e8e:66e6 with SMTP id k26-20020a056870819a00b0021e9e8e66e6mr478170oae.4.1708474830562; Tue, 20 Feb 2024 16:20:30 -0800 (PST) Path: csiph.com!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.javascript Date: Tue, 20 Feb 2024 16:20:30 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=77.57.50.239; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r NNTP-Posting-Host: 77.57.50.239 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: ANN: Dogelog Player 1.1.5 (HTTP Server) From: Mild Shock Injection-Date: Wed, 21 Feb 2024 00:20:30 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Lines: 104 Xref: csiph.com comp.lang.javascript:122844 Also the Kotlin language and runtime might suffer from=20 not enough "DIRECT STYLE" and even ignoring Doug Leas java.util.concurrent.Flow, devlivering some bloated redundant nonsense I speculate from glossing over it.=20 Flow has an interesting history. And all the new JDK 21=20 integrate HTTP server and HTTP client make use of=20 the interfaces bundled by the class Flow. But I am=20 tapping into it via ordinary InputStream and OutputStream. Reactive Streams started as an initiative in late 2013=20 between engineers at Netflix, Pivotal and Lightbend.=20 Reactive Streams were proposed to become part of=20 Java 9 by Doug Lea, leader of JSR 166 as a new Flow=20 class that would include the interfaces currently=20 provided by Reactive Streams. https://en.wikipedia.org/wiki/Reactive_Streams Mild Shock schrieb am Mittwoch, 21. Februar 2024 um 01:13:39 UTC+1: > Its also proof of concept that no stack copying=20 > is necessary. Well its not 100% true the Prolog=20 > interpreter does a little bit unwind and rewind=20 >=20 > during the '$YIELD'/1 instruction. But we do=20 > nowhere copy some native stack, this is unlike=20 > Martin Odersky's speculation, he might implement=20 >=20 > someting with stack copying. Except that a virtual=20 > threads might using a copying when they resize=20 > their stack, I don't see any need for copying.=20 >=20 > Also sometimes a callback can be piggy packed on=20 > an existing coroutine if it doesn't yield itself,=20 > I am already using this in Dogelog Player as an=20 >=20 > optimization. The idea to use semaphores in my=20 > implementation can be credited to this paper=20 > from 1980 where semaphores are the main switchpoint:=20 >=20 > Extension of Pascal and its Application to=20 > Quasi-Parallel Programming and Simulation, Software -=20 > Practice and Experience, 10 (1980), 773-789=20 > J. Kriz and H. Sandmayr=20 > https://www.academia.edu/47139332=20 >=20 > But my experience with JDK 21 virtual threads=20 > is still poor, I am only beginning to explore them=20 > as a way to have a large number of coroutines.=20 >=20 > Mild Shock schrieb: > >=20 > > Basically you can programm in so called "DIRECT STYLE"=20 > > even if async I/O is involved, which might be even a=20 > > shock for functional programming language users=20 > >=20 > > that are used to a lot of nonsense.=20 > >=20 > > See also:=20 > >=20 > > Async/Await for the Monadic Programmer=20 > > https://www.youtube.com/watch?v=3DOH5cxLNTTPo=20 > >=20 > > DIRECT STYLE SCALA Scalar Conference 2023=20 > > https://www.youtube.com/watch?v=3D0Fm0y4K4YO8=20 > >=20 > > Mild Shock schrieb:=20 > >>=20 > >> Well they have suspend/resume semantics. They=20 > >> are not continuations. They aim is to provide=20 > >> async/await and not only setTimeout().=20 > >>=20 > >> As a result you don't need to write libraries=20 > >> with a continuation parameters. This is very unlike=20 > >> nonsense such as the express web framework.=20 > >>=20 > >> stackfulness=20 > >> In contrast to a stackless coroutine a stackful=20 > >> coroutine can be suspended from within a nested=20 > >> stackframe. Execution resumes at exactly the same=20 > >> point in the code where it was suspended before.=20 > >>=20 > >> stackless=20 > >> With a stackless coroutine, only the top-level routine=20 > >> may be suspended. Any routine called by that top-level=20 > >> routine may not itself suspend. This prohibits=20 > >> providing suspend/resume operations in routines within=20 > >> a general-purpose library.=20 > >> https://www.boost.org/doc/libs/1_57_0/libs/coroutine/doc/html/coroutin= e/intro.html#coroutine.intro.stackfulness=20 > >>=20 > >>=20 > >>=20 > >> Lawrence D'Oliveiro schrieb:=20 > >>> On Tue, 20 Feb 2024 17:09:53 +0100, Mild Shock wrote:=20 > >>>=20 > >>>> The idea is that threads use a bouncer semaphore to get a permission= to=20 > >>>> execute and thus become =E2=80=9Ccoroutines=E2=80=9D.=20 > >>>=20 > >>> But they are still stackful coroutines, not stackless.=20 > >>>=20 > >>=20 > >