aleks, to Kotlin
@aleks@hachyderm.io avatar

Fixed that pesky bug by… running everything synchronously!

Concurrency is hard, let's go shopping…

amoroso, to programming
@amoroso@fosstodon.org avatar

Can you recommend any general learning resources on coroutines?

I'm looking for tutorials, books, or other non-video sources that are largely language independent (or introduce a few primitives clearly) and, most importantly, explain how to program with couroutines and for which problems or situations they're typically used. I'm looking to learn the concepts, not features of specific languages.

I'm not interested in other control or concurrency primitives.

christianp, to python
@christianp@mathstodon.xyz avatar

Today I need to understand coroutines and futures. The documentation doesn't explain it at all well to me.
I'm very comfortable using async/await in JavaScript.
Does anyone have any pointers?

chemacortes,

@christianp In python, the cornerstone of asynchronous processes is the asyncio module. Take a look in their documentation.

There is a good reference from Real Python: https://realpython.com/async-io-python/

Also read in the official documentation this chapter:

https://docs.python.org/3/library/asyncio-task.html

I hope it helps.

toxi, to typescript
@toxi@mastodon.thi.ng avatar

Earlier today I released a new version of https://thi.ng/fibers aka building blocks and operators for coroutine-based multitasking and alternative to async-await. It's one of the more recent packages, but also one which is quickly cementing itself as one of the most powerful & flexible tools of the whole collection, similar to how https://thi.ng/transducers & https://thi.ng/rstream have done in other contexts...

Recent versions have included new helpers to improve interop between fibers and async functions and to simplify time-sliced processing of child tasks and/or iterables (incl. via transducers).

The attached code snippet shows an example excerpt of how this is used in the recent (and even more recently updated) Mastodon UI demo. See linked toot for demo link & fully commented source code...

https://mastodon.thi.ng/@toxi/111069280667363259

uliwitness, to programming
@uliwitness@chaos.social avatar

Can a Swift async method return multiple results over time? Different types, so I don’t think I can use AsyncSequence? Something like (pseudocode)

let (showProgress: async Bool, result: async MyThing) = await doSomethingLengthy()
if await showProgress {
showProgressScreen()
}
processResult(await result)

?

doSomethingLengthy() would guarantee that doProgress is fulfilled before result, in case that helps.

Or must it be a 2-method delegate?

toxi, (edited ) to random
@toxi@mastodon.thi.ng avatar

After some friendly inquiry by @computersandblues, I spent a few hours today adding basic CSP () primitives for https://thi.ng/fibers and writing some preliminary documentation. I'm amazed how simple (and easy!) it was this time around (compared to https://thi.ng/csp) and it's giving me big hopes for the fiber based approach in general...

Readme section:
https://github.com/thi-ng/umbrella/blob/develop/packages/fibers/README.md#csp-primitives-communicating-sequential-processes

2-channel ping/pong example:
https://github.com/thi-ng/umbrella/blob/develop/packages/fibers/README.md#csp-pingpong-example

Source code & doc strings:
https://github.com/thi-ng/umbrella/blob/develop/packages/fibers/src/csp.ts

winslowjosiah, to random
@winslowjosiah@hachyderm.io avatar

🧵 Day 1

After prototyping a decent Othello AI, I'm trying to decide how to represent the Othello board in PICO-8.

  • 2D array
    pros: intuitive
    cons: slow to use

  • bitboard
    pros: uses bitops on 64-bit nums (fast!)
    cons: PICO-8 doesn't have 64-bit nums; will have to adapt

winslowjosiah,
@winslowjosiah@hachyderm.io avatar
winslowjosiah,
@winslowjosiah@hachyderm.io avatar

Day 20

Because I'm using everywhere, I decided to create a centralized system for them, instead of having like 4 systems that each work differently.

Now it'll be easier to run things like the and the box at the same time. (Check out that box!)

A pixelated Othello game with a minimalist aesthetic. Every so often, a white box drops down from the top and a test message is typed onto it.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • thenastyranch
  • ethstaker
  • osvaldo12
  • mdbf
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • Youngstown
  • ngwrru68w68
  • slotface
  • GTA5RPClips
  • rosin
  • megavids
  • cubers
  • everett
  • cisconetworking
  • tacticalgear
  • anitta
  • khanakhh
  • normalnudes
  • Durango
  • modclub
  • tester
  • provamag3
  • Leos
  • lostlight
  • All magazines