Is there a naming convention for functions returni...
# coroutines
d
Is there a naming convention for functions returning a
Flow
? (like Async suffix for the ones returning a
Deferred
)
o
for me the answer is no, because it is similar to a Stream-returning function, which I don't name differently from other functions. Typically they are named to indicate a collection/iterable, such as
listItems()
1
e
Deferred
is error-prone (it’s hot and you must not forget to await!) hence the naming convention to warn the user. There are no such problems with flow, hence no need for a special naming.
d
Okay, thank you! :)
r
you must not forget to await!
@elizarov Will you have issues if you don't await, or will you just not get the value?
e
You will lose exception if the method returning deferred failed, unless it was using structured concurrency.
r
Ah, I didn't think about that. Thanks!
l
Somtimes, I suffix the property or function with
Flow
, like
locationUpdatesFlow
.
d
That's what I was doing, but it's ugly!
r
Maybe suffix with
AF
for, uh, as flow... 🧌
d
I'm considering -Flower
😆 1
🙂