3 ms·
How do they work in Kotlin? If it’s just: result = co_func() Then that creates an invisible yield point which messes with your “is this a critical section”
by wruza 2y ago
How do they work in Kotlin? If it’s just:
result = co_func()
Then that creates an invisible yield point which messes with your “is this a critical section” sense. Suddenly anything may yield and your naive
pt.x = getX()
pt.y = getY()
turns into the concurrency hell wrt pt’s consistency.
I think await should be the default not the exception, and Kotlin is closer to that.
I somewhat agree in that it should be an await/nowait keyword pair required at async calls. Not realistic though even in typescript, considering that Promise{} is just a continuation shell that may be passed around freely and doesn’t represent a specific function’s asynchronicity.
- hinkley 2y agoThe biggest problem with the Node/Javascript solution is that if I call a function and don’t need the result, if that function is changed to async (or I missed that it always was) end up with bugs because we didn’t await the result. When I say things like this people typically claim I’m bringing up some hypothetical, so let me be clear: I’m tired of fixing this bug. Not in my code (mostly), but in the code base. It happens too often both in a numerical sense and in a sense that it’s so stupid that it happens at all. It’s how I started thinking about this problem in the first place. The solution we have isn’t working very well.