What is the naming convention in Scala for function returning result wrapped in Future? I have seen code like:
getResult
getResultF
getResultFtr
Or even
getResultFuture
If there is no specific convention then I would like to know what is practiced more.
I usually don't name methods returning Futures
any differently. My reason is that this information is already present in the return type, and will be made clear by any decent IDE upon autocompletion.
One exception is in the presence of another similar method that doesn't return a Future
but does everything synchronously. In that case, I like to clearly differentiate them:
def fooSync: A
def fooAsync: Future[A]
That's a pattern I've seen in plenty of libraries.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.