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

프로미스(promise)라는 용어는 1976년 [[대니얼 P. 프리드먼]]과 데이비드 와이즈가 제안하였으며,<ref>{{콘퍼런스 인용
| first= Daniel
| last= Friedman
|author2=David Wise
| year= 1976
| title= The Impact of Applicative Programming on Multiprocessing
| conference= International Conference on Parallel Processing
| pages=263–272
}}</ref>
피터 히버드는 eventual로 명명하였다.<ref>{{콘퍼런스 인용
| first= Peter
| last= Hibbard
| year= 1976
| title= Parallel Processing Facilities
| conference= New Directions in Algorithmic Languages, (ed.) Stephen A. Schuman, IRIA, 1976.
}}</ref>
일부 비슷한 개념인 퓨처(future)는 1977년 [[헨리 베이커]]와 [[칼 히위트]]의 논문에 등장하였다.<ref>{{콘퍼런스 인용
| author1=Henry Baker
| author2=Carl Hewitt
| title=The Incremental Garbage Collection of Processes
| conference=Proceedings of the Symposium on Artificial Intelligence Programming Languages
| publisher=ACM SIGPLAN Notices 12, 8
| date=August 1977
| pages=55–59
| url=http://home.pipeline.com/~hbaker1/Futures.html
| access-date=2020-08-13
| archive-date=2008-07-04
| archive-url=https://web.archive.org/web/20080704132429/http://home.pipeline.com/~hbaker1/Futures.html
}}</ref>

퓨처, 프로미스, 딜레이, 디퍼드라는 용어는 종종 번갈아 사용되지만 퓨처와 프로미스 사이에는 이용 면에서 일부 차이가 있다. 퓨처는 변수의 읽기 전용 플레이스홀더인 반면 프로미스는 미래의 값을 저장하는, 쓰기가 가능한 [[단일 할당]] 컨테이너이다.<ref>"[http://docs.scala-lang.org/sips/completed/futures-promises.html SIP-14 – Futures and Promises] {{웨이백|url=http://docs.scala-lang.org/sips/completed/futures-promises.html |date=20190705213941 }}"</ref> 퓨처는 어느 특정 프로미스가 값을 설정할지를 지정하지 않고 정의할 수 있으며 각기 다른 잠재적인 프로미스들이 주어진 퓨처의 값을 설정할 수 있지만 주어진 퓨처에 대해 오직 한 번만 수행이 가능하다. 그 밖의 경우 퓨처와 프로미스는 함께 만들어지며 서로 연결된다. 즉, 퓨처는 값이고 프로미스는 값을 설정하는 함수, 특히 비동기 함수(프로미스)의 반환값(퓨처)을 의미한다. 퓨처의 값을 설정하는 것은 바인딩(binding), 풀필링(fulfilling), 리졸빙(resolving)으로 부른다.

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

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

* ABCL/f<ref>{{콘퍼런스 인용
|author1=Kenjiro Taura |author2=Satoshi Matsuoka |author3=Akinori Yonezawa | year= 1994
| title= ABCL/f: A Future-Based Polymorphic Typed Concurrent Object-Oriented Language – Its Design and Implementation.
| booktitle= In Proceedings of the DIMACS workshop on Specification of Parallel Algorithms, number 18 in Dimacs Series in Discrete Mathematics and Theoretical Computer Science
| pages= 275–292
| citeseerx=10.1.1.23.1161
| doi= 
| publisher= American Mathematical Society
}}</ref>
* [[앨리스 (프로그래밍 언어)|Alice ML]]
* [[AmbientTalk]] (including first-class resolvers and read-only promises)
* [[C++]], starting with [[C++11|C++11]]: std::future and std::promise
** [[μC++]]
<!--C# is under .NET below-->
** Compositional C++
* [[Crystal (programming language)]]
* [[다트 (프로그래밍 언어)|Dart]] (with ''Future''/''Completer'' classes<ref name="dartCompleter">{{웹 인용
|url=https://api.dartlang.org/1.12.1/dart-async/Completer-class.html
|title=Dart SDK dart async Completer
}}</ref> and the keywords ''await'' and ''async''<ref name="dart">{{웹 인용
|url=https://www.dartlang.org/articles/await-async/
|title=Dart Language Asynchrony Support: Phase 1
|author=Gilad Bracha
|date=October 2014
}}</ref>)
* [[Elm (programming language)]] via the ''Task'' module<ref name="elmTask">{{웹 인용
|title=Task
|url=http://package.elm-lang.org/packages/elm-lang/core/latest/Task
}}</ref>
* Glasgow [[하스켈]] (I-vars and M-vars only)
* [[Id (programming language)|Id]] (I-vars and M-vars only)
* [[아이오 (프로그래밍 언어)|Io]]<ref>{{웹 인용
| author= Steve Dekorte
| year= 2005
| title= Io, The Programming Language
| url= http://iolanguage.org/guide/guide.html#Concurrency-Futures
}}</ref>
* [[자바 (프로그래밍 언어)|자바]] via {{Javadoc:SE|package=java.util.concurrent|java/util/concurrent|Future}} or {{Javadoc:SE|package=java.util.concurrent|java/util/concurrent|CompletableFuture}}
** [[자바 (프로그래밍 언어)]]
* [[자바스크립트]] (limited, as of [[ECMA스크립트]] 6)
* [[Lucid (programming language)|Lucid]] (dataflow only)
* Some [[리스프|Lisps]]
** [[클로저 (프로그래밍 언어)]]<ref>{{웹 인용
| author= Rich Hickey
| year= 2009
| title= changes.txt at 1.1.x from richhickey's clojure
| url= https://github.com/richhickey/clojure/blob/1.1.x/changes.txt#L130
}}</ref>
** [[MultiLisp]]
* [[닷넷 프레임워크|.NET]] via ''Task''s
** [[C 샤프|C#]], since .NET Framework 4.5,<ref name="asyncdotnet45">{{웹 인용 |url=http://blogs.msdn.com/b/dotnet/archive/2012/04/03/async-in-4-5-worth-the-await.aspx |title=Async in 4.5: Worth the Await – .NET Blog – Site Home – MSDN Blogs |publisher=Blogs.msdn.com |date= |accessdate=2014-05-13 |archive-date=2012-04-07 |archive-url=https://web.archive.org/web/20120407032353/http://blogs.msdn.com/b/dotnet/archive/2012/04/03/async-in-4-5-worth-the-await.aspx |url-status=dead }}</ref> via the keywords <code>async</code> and <code>await</code><ref name="dotnetasyncawait">{{웹 인용|url=http://msdn.microsoft.com/en-us/library/hh191443.aspx |title=Asynchronous Programming with Async and Await (C# and Visual Basic) |publisher=Msdn.microsoft.com |date= |accessdate=2014-05-13}}</ref>
* [[Nim (programming language)|Nim]]
* [[옥시즌 (프로그래밍 언어)|Oxygene]]
* [[오즈 (프로그래밍 언어)|Oz]] version 3<ref>{{웹 인용 |url=http://www.mozart-oz.org/documentation/tutorial/node1.html |title=Tutorial of Oz |publisher=Mozart Global User Library |accessdate=12 April 2011 |author=Seif Haridi |author2=Nils Franzen |archive-date=2011-05-14 |archive-url=https://web.archive.org/web/20110514010946/http://www.mozart-oz.org/documentation/tutorial/node1.html }}</ref>
* [[파이썬]] [https://docs.python.org/3/library/concurrent.futures.html concurrent.futures], since 3.2,<ref>[https://www.python.org/download/releases/3.2/ Python 3.2 Release]</ref> as proposed by the [https://www.python.org/dev/peps/pep-3148/ PEP 3148], and Python 3.5 added async and await<ref>[https://www.python.org/downloads/release/python-350/ Python 3.5 Release]</ref>
* [[R (프로그래밍 언어)|R]] (promises for lazy evaluation, still single threaded)
* [[래킷 (프로그래밍 언어)|Racket]]<ref>{{웹 인용|url=http://docs.racket-lang.org/guide/performance.html#(part._effective-futures)|title=Parallelism with Futures|publisher=PLT|accessdate=2 March 2012}}</ref>
* [[펄 6|Raku]]<ref>[https://docs.perl6.org/type/Promise Promise class in Perl 6]</ref>
* [[스칼라 (프로그래밍 언어)|Scala]] via [http://docs.scala-lang.org/overviews/core/futures.html scala.concurrent package]
* [[스킴 (프로그래밍 언어)|Scheme]]
* [[스퀵]] [[스몰토크]]
* [[Strand (programming language)|Strand]]
* [[스위프트 (프로그래밍 언어)|Swift]] (only via third-party libraries)
* [[비주얼 베이직 닷넷|Visual Basic]] 11 (via the keywords ''Async'' and ''Await'')<ref name="dotnetasyncawait"/>

프로미스 파이프라이닝을 지원하는 언어:
* [[E (프로그래밍 언어)|E]]
* [[줄 (프로그래밍 언어)|줄]]

=== 비표준 라이브러리 기반 퓨처 구현체 목록 ===
* For [[커먼 리스프]]:
** Blackbird<ref>[https://orthecreedence.github.io/blackbird/ Common Lisp Blackbird]</ref>
** Eager Future2<ref>[http://common-lisp.net/project/eager-future/ Common Lisp Eager Future2]</ref>
** lparallel<ref>[https://lparallel.org Lisp in parallel – A parallel programming library for Common Lisp]</ref>
** PCall<ref>[http://marijnhaverbeke.nl/pcall/ Common Lisp PCall]</ref>
* For C++:
** [[Boost|Boost library]]<ref>{{웹 인용
 |url=http://www.boost.org/doc/libs/release/doc/html/thread.html
 |title=Chapter 30. Thread 4.0.0
 |accessdate=26 June 2013}}</ref>
** [[Dlib]]<ref>{{웹 인용
 |url=http://www.boost.org/doc/libs/release/doc/html/thread.html
 |title=Dlib C++ Library #thread_pool
 |accessdate=26 June 2013}}</ref>
** [[Qt (프레임워크)|Qt]]<ref>{{웹 인용
 |url=https://qt-project.org/doc/qt-5.0/qtcore/qfuture.html
 |title=QtCore 5.0: QFuture Class
 |publisher=Qt Project
 |accessdate=26 June 2013
 |archive-url=https://web.archive.org/web/20130601062401/http://qt-project.org/doc/qt-5.0/qtcore/qfuture.html
 |archive-date=1 June 2013
 |url-status=dead
 }}</ref>
** Seastar<ref>{{웹 인용
 |url=http://seastar-project.org
 |title=Seastar
 |publisher=Seastar project
 |accessdate=22 August 2016}}</ref>
** Folly<ref>{{웹 인용|url=https://github.com/facebook/folly|title=GitHub – facebook/folly: An open-source C++ library developed and used at Facebook.|date=2019-01-08}}</ref>
** [[POCO C++ Libraries]] (Active Results)<ref>{{웹 인용|url=https://pocoproject.org/slides/130-Threads.pdf|title=Threads Slides of POCO}}</ref>
** HPX<ref>{{웹 인용|url=http://stellar-group.org/libraries/hpx/|title=HPX|date=2019-02-10}}</ref>
* For [[C 샤프|C#]] and other [[닷넷 프레임워크|.NET]] languages: The [[Parallel Extensions]] library
* For [[그루비 (프로그래밍 언어)|Groovy]]: GPars<ref>[http://gpars.codehaus.org Groovy GPars] {{webarchive|url=https://web.archive.org/web/20130112092827/http://gpars.codehaus.org/ |date=12 January 2013 }}</ref>
* For [[자바스크립트]]:
** Cujo.js'<ref>{{웹 인용 |url=http://cujojs.com/ |제목=Cujo.js |확인날짜=2021-06-12 |archive-date=2012-03-17 |archive-url=https://web.archive.org/web/20120317193626/http://cujojs.com/ }}</ref> when.js<ref>[https://github.com/cujojs/when JavaScript when.js]</ref> provides promises conforming to the Promises/A+<ref>[http://promisesaplus.com Promises/A+ specification]</ref> 1.1 specification
** The [[Dojo Toolkit]] supplies promises<ref>[http://dojotoolkit.org/documentation/tutorials/1.6/promises/ promises]</ref> and [[트위스티드 (소프트웨어)|Twisted]] style deferreds
** [[MochiKit]]<ref>[https://mochi.github.io/mochikit/doc/html/MochiKit/Async.html JavaScript MochKit.Async]</ref> inspired by [[트위스티드 (소프트웨어)|Twisted's Deferreds]]
** [http://jquery.com/ jQuery's] [//api.jquery.com/category/deferred-object/ Deferred Object] is based on the [http://wiki.commonjs.org/wiki/Promises/A CommonJS Promises/A] design.
** AngularJS<ref>[https://angularjs.org/ JavaScript Angularjs]</ref>
** [[Node.js|node]]-promise<ref>[https://github.com/kriszyp/node-promise JavaScript node-promise]</ref>
** Q, by Kris Kowal, conforms to Promises/A+ 1.1<ref>{{웹 인용 |url=http://documentup.com/kriskowal/q |제목=JavaScript Q |확인날짜=2020-08-13 |archive-date=2018-12-31 |archive-url=https://web.archive.org/web/20181231093236/http://documentup.com/kriskowal/q |url-status= }}</ref>
** RSVP.js, conforms to Promises/A+ 1.1<ref>[https://github.com/tildeio/rsvp.js JavaScript RSVP.js]</ref>
** YUI's<ref>[http://yuilibrary.com/ YUI JavaScript class library]</ref> promise class<ref>[http://yuilibrary.com/yui/docs/promise/ YUI JavaScript promise class]</ref> conforms to the Promises/A+ 1.0 specification.
** Bluebird, by Petka Antonov<ref>[https://github.com/petkaantonov/bluebird JavaScript Bluebird]</ref>
** The [[구글 클로저 툴스|Closure Library]]'s [https://github.com/google/closure-library/tree/master/closure/goog/promise promise] package conforms to the Promises/A+ specification.
** See [http://promisesaplus.com/implementations Promise/A+'s] list for more implementations based on the Promise/A+ design.
* For [[자바 (프로그래밍 언어)|자바]]:
** JDeferred, provides deferred-promise API and behavior similar to [[JQuery]].Deferred object<ref>[http://jdeferred.org Java JDeferred]</ref>
** ParSeq<ref>[https://github.com/linkedin/parseq/wiki Java ParSeq]</ref> provides task-promise API ideal for asynchronous pipelining and branching, maintained by [[링크드인]]
* For [[루아 (프로그래밍 언어)|Lua]]:
** The cqueues [https://www.25thandclement.com/~william/projects/cqueues.html] module contains a Promise API.
* For [[오브젝티브-C]]: MAFuture,<ref>[https://github.com/mikeash/MAFuture Objective-C MAFuture GitHub]</ref><ref>[http://www.mikeash.com/pyblog/friday-qa-2010-02-26-futures.html Objective-C MAFuture mikeash.com]</ref> RXPromise,<ref>[https://github.com/couchdeveloper/RXPromise Objective-C RXPromise]</ref> ObjC-CollapsingFutures,<ref>[https://github.com/Strilanc/ObjC-CollapsingFutures ObjC-CollapsingFutures]</ref> PromiseKit,<ref>[http://promisekit.org/ Objective-C PromiseKit]</ref> objc-promise,<ref>[https://github.com/mproberts/objc-promise Objective-C objc-promise]</ref> OAPromise,<ref>[https://github.com/oleganza/OAPromise Objective-C OAPromise]</ref>
* For [[OCaml]]: Lazy module implements lazy explicit futures<ref>[http://caml.inria.fr/pub/docs/manual-ocaml/libref/Lazy.html OCaml Lazy]</ref>
* For [[펄]]: Future,<ref>[http://metacpan.org/module/Future Perl Future]</ref> Promises,<ref>[https://metacpan.org/pod/Promises Perl Promises]</ref> Reflex,<ref>[http://metacpan.org/module/Reflex/ Perl Reflex]</ref> and Promise::ES6<ref>[http://metacpan.org/module/Promise::ES6/ Perl Promise::ES6]</ref>
* For [[PHP]]: React/Promise<ref>[https://github.com/reactphp/promise PHP React/Promise]</ref>
* For [[파이썬]]:
** Built-in implementation<ref>[https://docs.python.org/3/library/asyncio-task.html#future Python built-in implementation]</ref>
** pythonfutures<ref>[http://code.google.com/p/pythonfutures/ pythonfutures]</ref>
** [[트위스티드 (소프트웨어)|Twisted's]] Deferreds<ref>{{웹 인용 |url=http://twistedmatrix.com/documents/current/core/howto/defer.html |제목=Twisted Deferreds |확인날짜=2020-08-13 |archive-date=2020-08-06 |archive-url=https://web.archive.org/web/20200806202718/https://twistedmatrix.com/documents/current/core/howto/defer.html |url-status= }}</ref>
* For [[R (프로그래밍 언어)|R]]:
** future, implements an extendable future API with lazy and eager synchronous and (multicore or distributed) asynchronous futures<ref>[https://cran.r-project.org/package=future R package future]</ref><ref>[https://cran.r-project.org/package=future future]</ref>
* For [[루비 (프로그래밍 언어)|Ruby]]:
** Promise gem<ref>[http://rubygems.org/gems/promise Ruby Promise gem]</ref>
** libuv gem, implements promises<ref>[https://github.com/cotag/libuv Ruby libuv]</ref>
** Celluloid gem, implements futures<ref>{{웹 인용 |url=http://celluloid.io/ |제목=Ruby Celluloid gem |확인날짜=2021-03-15 |archive-date=2013-05-08 |archive-url=https://web.archive.org/web/20130508122056/http://celluloid.io/ }}</ref>
** future-resource<ref>[https://github.com/adhearsion/future-resource Ruby future-resource]</ref>
* For [[러스트 (프로그래밍 언어)|Rust]]:
** futures-rs<ref>[https://github.com/alexcrichton/futures-rs futures-rs crate]</ref>
* For [[스칼라 (프로그래밍 언어)|Scala]]:
** Twitter's util library<ref>[https://twitter.github.io/util/ Twitter's util library]</ref>
* For [[스위프트 (프로그래밍 언어)|Swift]]:
** Async framework, implements C#-style <code>async</code>/non-blocking <code>await</code><ref>{{웹 인용 |url=https://bitbucket.org/al45tair/async |제목=Swift Async |확인날짜=2020-08-13 |archive-date=2018-12-31 |archive-url=https://web.archive.org/web/20181231092935/https://bitbucket.org/al45tair/async |url-status=dead }}</ref>
** FutureKit,<ref>[https://github.com/FutureKit/FutureKit Swift FutureKit]</ref> implements a version for Apple GCD<ref>[https://developer.apple.com/library/prerelease/mac/documentation/Performance/Reference/GCD_libdispatch_Ref/ Swift Apple GCD]</ref>
** FutureLib, pure Swift 2 library implementing Scala-style futures and promises with TPL-style cancellation<ref>[https://github.com/couchdeveloper/FutureLib Swift FutureLib]</ref>
** Deferred, pure Swift library inspired by OCaml's Deferred<ref>[https://github.com/bignerdranch/deferred bignerdranch/Deferred]</ref>
** BrightFutures<ref>[https://github.com/Thomvis/BrightFutures Thomvis/BrightFutures]</ref>
* For [[Tcl|Tcl]]: tcl-promise<ref>[https://sourceforge.net/projects/tcl-promise/ tcl-promise]</ref>

== 같이 보기 ==
* [[파이버 (컴퓨터 과학)]]
* [[Futex]]
== 각주 ==
{{각주}}

== 외부 링크 ==
* [http://shairosenfeld.com/concurrency.html Concurrency patterns presentation] given at [http://scaleconf.org scaleconf]
* [http://c2.com/cgi/wiki?FutureValue Future Value] and [http://c2.com/cgi/wiki?PromisePipelining Promise Pipelining] at the [[:en:Portland Pattern Repository]]
* [http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84317 Easy Threading with Futures] {{웨이백|url=http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84317 |date=20071210090520 }} in [[파이썬]]

[[분류:프로세스 간 통신]]