Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: base/callback.h.pump

Issue 11411319: Correct misleading definition of 'closure' in base/bind documentation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/callback.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback.h.pump
diff --git a/base/callback.h.pump b/base/callback.h.pump
index e236254d8a3f85aa4a20d79b13f66f631f416918..41d2ee9aecc9c2e3cc723adb7454b8f215deabb6 100644
--- a/base/callback.h.pump
+++ b/base/callback.h.pump
@@ -28,13 +28,18 @@ $var MAX_ARITY = 7
//
// The templated Callback class is a generalized function object. Together
// with the Bind() function in bind.h, they provide a type-safe method for
-// performing currying of arguments, and creating a "closure."
+// performing partial application of functions.
//
-// In programming languages, a closure is a first-class function where all its
-// parameters have been bound (usually via currying). Closures are well
-// suited for representing, and passing around a unit of delayed execution.
-// They are used in Chromium code to schedule tasks on different MessageLoops.
+// Partial application (or "currying") is the process of binding a subset of
+// a function's arguments to produce another function that takes fewer
+// arguments. This can be used to pass around a unit of delayed execution,
+// much like lexical closures are used in other languages. For example, it
+// is used in Chromium code to schedule tasks on different MessageLoops.
//
+// A callback with no unbound input parameters (base::Callback<void(void)>)
+// is called a base::Closure. Note that this is NOT the same as what other
+// languages refer to as a closure -- it does not retain a reference to its
+// enclosing environment.
//
// MEMORY MANAGEMENT AND PASSING
//
@@ -274,6 +279,8 @@ $var MAX_ARITY = 7
//
// By default Bind() will store copies of all bound parameters, and attempt
// to refcount a target object if the function being bound is a class method.
+// These copies are created even if the function takes parameters as const
+// references. (Binding to non-const references is forbidden, see bind.h.)
//
// To change this behavior, we introduce a set of argument wrappers
// (e.g., Unretained(), and ConstRef()). These are simple container templates
« no previous file with comments | « base/callback.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698