나는이 블로그 post을 읽고 있는데, Futures
은 단지 부작용의 래퍼이므로 계산법이므로 "기능적"이라고 주장하지 않습니다. 예를 들어 RPC 호출, HTTP 요청 등을 포함합니다. 맞습니까?Scala의 선물은 정말로 기능적입니까?
def twoUsersFeed(a: UserHandle, b: UserHandle)
(implicit ec: ExecutionContext): Future[Html] =
for {
feedA <- usersFeed(a)
feedB <- usersFeed(b)
} yield feedA ++ feedB
이
you lose the desired property: consistent results (the referential transparency). Also you lose the property of making as few requests as possible. It is difficult to use multi-valued requests and have composable code.
나는 그것을 얻을하지 않습니다 두려워 :
블로그 포스트는 다음 예제를 제공합니다. 이 경우 consistent result
을 어떻게 잃게되는지 설명해 주시겠습니까?
감사합니다. 이제는 분명합니다. 저는 표현 연산과 그 실행을 분리하는 아이디어를 좋아합니다. '자유 모나드 ' – Michael