퓨처와 프로미스

위키백과, 우리 모두의 백과사전.
(퓨처 프로그래밍에서 넘어옴)

컴퓨터 과학에서 퓨처(future), 프로미스(promise), 딜레이(delay), 디퍼드(deferred)는 일부 병행 프로그래밍 언어에서 프로그램 실행을 동기화하려고 쓰는 구조체다. 프록시 역할을 하는 객체로 설명되며 값의 연산이 아직 이루어지지 않은 상태이므로 결과는 미리 알 수 없다.

프로미스(promise)라는 용어는 1976년 대니얼 P. 프리드먼과 데이비드 와이즈가 제안하였으며,[1] 피터 히버드는 eventual로 명명하였다.[2] 일부 비슷한 개념인 퓨처(future)는 1977년 헨리 베이커칼 히위트의 논문에 등장하였다.[3]

퓨처, 프로미스, 딜레이, 디퍼드라는 용어는 종종 번갈아 사용되지만 퓨처와 프로미스 사이에는 이용 면에서 일부 차이가 있다. 퓨처는 변수의 읽기 전용 플레이스홀더인 반면 프로미스는 미래의 값을 저장하는, 쓰기가 가능한 단일 할당 컨테이너이다.[4] 퓨처는 어느 특정 프로미스가 값을 설정할지를 지정하지 않고 정의할 수 있으며 각기 다른 잠재적인 프로미스들이 주어진 퓨처의 값을 설정할 수 있지만 주어진 퓨처에 대해 오직 한 번만 수행이 가능하다. 그 밖의 경우 퓨처와 프로미스는 함께 만들어지며 서로 연결된다. 즉, 퓨처는 값이고 프로미스는 값을 설정하는 함수, 특히 비동기 함수(프로미스)의 반환값(퓨처)을 의미한다. 퓨처의 값을 설정하는 것은 바인딩(binding), 풀필링(fulfilling), 리졸빙(resolving)으로 부른다.

구현체 목록[편집]

일부 프로그래밍 언어들은 퓨처, 프로미스, 병행 논리 변수, 데이터플로 변수, l-var을 지원하며 이는 직접 언어 지원을 통해서나 표준 라이브러리를 통해 제공된다.

프로그래밍 언어에 따른 퓨처와 프로미스 관련 개념 목록[편집]

프로미스 파이프라이닝을 지원하는 언어:

비표준 라이브러리 기반 퓨처 구현체 목록[편집]

각주[편집]

  1. Friedman, Daniel; David Wise (1976). 《The Impact of Applicative Programming on Multiprocessing》. International Conference on Parallel Processing. 263–272쪽. 
  2. Hibbard, Peter (1976). 《Parallel Processing Facilities》. New Directions in Algorithmic Languages, (ed.) Stephen A. Schuman, IRIA, 1976. 
  3. Henry Baker; Carl Hewitt (August 1977). 《The Incremental Garbage Collection of Processes》. Proceedings of the Symposium on Artificial Intelligence Programming Languages. ACM SIGPLAN Notices 12, 8. 55–59쪽. 2008년 7월 4일에 원본 문서에서 보존된 문서. 2020년 8월 13일에 확인함. 
  4. "SIP-14 – Futures and Promises Archived 2019년 7월 5일 - 웨이백 머신"
  5. Kenjiro Taura; Satoshi Matsuoka; Akinori Yonezawa (1994). 〈ABCL/f: A Future-Based Polymorphic Typed Concurrent Object-Oriented Language – Its Design and Implementation.〉. 《In Proceedings of the DIMACS workshop on Specification of Parallel Algorithms, number 18 in Dimacs Series in Discrete Mathematics and Theoretical Computer Science》. American Mathematical Society. 275–292쪽. CiteSeerX 10.1.1.23.1161. 
  6. “Dart SDK dart async Completer”. 
  7. Gilad Bracha (October 2014). “Dart Language Asynchrony Support: Phase 1”. 
  8. “Task”. 
  9. Steve Dekorte (2005). “Io, The Programming Language”. 
  10. Rich Hickey (2009). “changes.txt at 1.1.x from richhickey's clojure”. 
  11. “Async in 4.5: Worth the Await – .NET Blog – Site Home – MSDN Blogs”. Blogs.msdn.com. 2012년 4월 7일에 원본 문서에서 보존된 문서. 2014년 5월 13일에 확인함. 
  12. “Asynchronous Programming with Async and Await (C# and Visual Basic)”. Msdn.microsoft.com. 2014년 5월 13일에 확인함. 
  13. Seif Haridi; Nils Franzen. “Tutorial of Oz”. Mozart Global User Library. 2011년 5월 14일에 원본 문서에서 보존된 문서. 2011년 4월 12일에 확인함. 
  14. Python 3.2 Release
  15. Python 3.5 Release
  16. “Parallelism with Futures”. PLT. 2012년 3월 2일에 확인함. 
  17. Promise class in Perl 6
  18. Common Lisp Blackbird
  19. Common Lisp Eager Future2
  20. Lisp in parallel – A parallel programming library for Common Lisp
  21. Common Lisp PCall
  22. “Chapter 30. Thread 4.0.0”. 2013년 6월 26일에 확인함. 
  23. “Dlib C++ Library #thread_pool”. 2013년 6월 26일에 확인함. 
  24. “QtCore 5.0: QFuture Class”. Qt Project. 2013년 6월 1일에 원본 문서에서 보존된 문서. 2013년 6월 26일에 확인함. 
  25. “Seastar”. Seastar project. 2016년 8월 22일에 확인함. 
  26. “GitHub – facebook/folly: An open-source C++ library developed and used at Facebook.”. 2019년 1월 8일. 
  27. “Threads Slides of POCO” (PDF). 
  28. “HPX”. 2019년 2월 10일. 
  29. Groovy GPars 보관됨 12 1월 2013 - 웨이백 머신
  30. “Cujo.js”. 2012년 3월 17일에 원본 문서에서 보존된 문서. 2021년 6월 12일에 확인함. 
  31. JavaScript when.js
  32. Promises/A+ specification
  33. promises
  34. JavaScript MochKit.Async
  35. JavaScript Angularjs
  36. JavaScript node-promise
  37. “JavaScript Q”. 2018년 12월 31일에 원본 문서에서 보존된 문서. 2020년 8월 13일에 확인함. 
  38. JavaScript RSVP.js
  39. YUI JavaScript class library
  40. YUI JavaScript promise class
  41. JavaScript Bluebird
  42. Java JDeferred
  43. Java ParSeq
  44. Objective-C MAFuture GitHub
  45. Objective-C MAFuture mikeash.com
  46. Objective-C RXPromise
  47. ObjC-CollapsingFutures
  48. Objective-C PromiseKit
  49. Objective-C objc-promise
  50. Objective-C OAPromise
  51. OCaml Lazy
  52. Perl Future
  53. Perl Promises
  54. Perl Reflex
  55. Perl Promise::ES6
  56. PHP React/Promise
  57. Python built-in implementation
  58. pythonfutures
  59. “Twisted Deferreds”. 2020년 8월 6일에 원본 문서에서 보존된 문서. 2020년 8월 13일에 확인함. 
  60. R package future
  61. future
  62. Ruby Promise gem
  63. Ruby libuv
  64. “Ruby Celluloid gem”. 2013년 5월 8일에 원본 문서에서 보존된 문서. 2021년 3월 15일에 확인함. 
  65. Ruby future-resource
  66. futures-rs crate
  67. Twitter's util library
  68. “Swift Async”. 2018년 12월 31일에 원본 문서에서 보존된 문서. 2020년 8월 13일에 확인함. 
  69. Swift FutureKit
  70. Swift Apple GCD
  71. Swift FutureLib
  72. bignerdranch/Deferred
  73. Thomvis/BrightFutures
  74. tcl-promise

외부 링크[편집]