Call it `blockBlock`, a verb and a noun. Problem s...
# coroutines
c
Call it
blockBlock
, a verb and a noun. Problem solved.
🧌 4
v
cedric: this whole thing with nouns-vs-verbs is not clear to me
I understand why JB wants functions to be nouns - because this is like commanding the compiler
run blocking!
But on the other hand if we have a
blocking { launch() }
scope function, it is like commanding
launch, but blocking
E.i. "blocking" is participle here, not a noun
Opinions?
k
I'm actually wondering why we need runblocking... If it's running on the current thread, it's like it's inline code, isn't it? What's the difference between the code without that keyword?
c
@voddan I agree. I think it's important to try and be consistent by default (e.g.
Optional
from Java makes more sense than
Option
of Scala) but you shouldn't try to take this too far. To me,
runBlocking
is perfectly acceptable.
v
@cedric sooo, you don't see a big deal having
runBlocking
instead of
blocking
?
c
Not really
v
oh, ok. It is just that I was trying to express why I don't see a good enough reason to have an uglier
runBlocking
good to know that ether way the API is "good enough"
r
@voddan I think they're equal.
blocking
looks prettier, but
runBlocking
is clearer. Both of those claims are opinions though, so getting everyone's opinion on the matter is valuable.
👍 1
It's a similar problem with
async
vs
defer
.
defer
is more accurate and clear, but
async
is more familiar.
k
Ahhh...I see...Runblocking is just to make it explicit. One of the things that is not obvious with c# async await is that an async method is blocking into you hit the first await. This is the same thing...