zlacker

[return to "The bane of my existence: Supporting both async and sync code in Rust"]
1. xedrac+zh[view] [source] 2024-01-19 23:38:16
>>lukast+(OP)
When writing some IO bound application, async Rust is great. Less great for libraries that want to support both async and sync without having to make an async runtime a dependency if you just want the sync interface. Mutually exclusive features are taboo unfortunately. One thing I really love about Haskell is you can make any function run in a green thread by simply composing it with the 'async' function. There's nothing special about it. This works much better than say Go, because Haskell is immutable.
◧◩
2. XorNot+ri[view] [source] 2024-01-19 23:42:57
>>xedrac+zh
I'm not clear what your last sentence has to do with anything else? What does immutability have to do with Async/sync conversions?
◧◩◪
3. polyga+Ol[view] [source] 2024-01-20 00:11:51
>>XorNot+ri
Immutability is great for multithreaded/async programs because every thread can rest assured knowing no other thread can sneakily modify objects that they are operating on currently.
◧◩◪◨
4. wredue+pD[view] [source] 2024-01-20 03:10:20
>>polyga+Ol
Immutability is, quite possibly, the dumbest “silver bullet” solution ever to be praised as a solution to anything.

Congratulations, nobody is going to sneakily update an object on you, but also, nobody knows about your updates either.

It’s not a worthwhile trade off given the massive extra work it causes.

◧◩◪◨⬒
5. throwa+zN[view] [source] 2024-01-20 05:14:26
>>wredue+pD
Completely uninformed take. Some of the most impressive update notification systems are built off of pass-as-immutable runtimes (for example: phoenix live view + phoenix pubsub). Try implementing that in just about a y other language. You will trip over yourself eight ways to hell

The whole idea of CQRS is to build separate (segregated) pathways for updates. Immutable passing plays extremely well with CQRS. The alternative is the complete clusterfuck that is two way data bindings (e.g. out of the box angularjs)

◧◩◪◨⬒⬓
6. tgv+wX[view] [source] 2024-01-20 07:47:10
>>throwa+zN
I think you both are referring to the same point: you can't update an immutable object, so you have to set up some mechanism to keep changes in sync.
◧◩◪◨⬒⬓⬔
7. throwa+a01[view] [source] 2024-01-20 08:27:26
>>tgv+wX
Yeah, and update mechanisms are not created equal. two way data bindings suck because they elide the challenges of distributed consistency.

When you're immutable, you can still delete or replace data.

[go to top]