summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordubroy@chromium.org <dubroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-06 19:00:50 +0000
committerdubroy@chromium.org <dubroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-06 19:00:50 +0000
commit68639bbeb2bdf5b003f8287892498b52cbd6707f (patch)
tree627aa7eb9ffd2374c2ccf7ec0a6b6172e3fd9a94 /base
parent9d34eb23c68f8131c9fef78276ef63db03e84616 (diff)
downloadchromium_src-68639bbeb2bdf5b003f8287892498b52cbd6707f.zip
chromium_src-68639bbeb2bdf5b003f8287892498b52cbd6707f.tar.gz
chromium_src-68639bbeb2bdf5b003f8287892498b52cbd6707f.tar.bz2
Correct misleading definition of 'closure' in base/bind documentation.
Also move groby's doc update (https://chromiumcodereview.appspot.com/11091056/) into the source file from the generated file. BUG= Review URL: https://chromiumcodereview.appspot.com/11411319 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/callback.h17
-rw-r--r--base/callback.h.pump17
2 files changed, 23 insertions, 11 deletions
diff --git a/base/callback.h b/base/callback.h
index 594c9d6..ade3f8c 100644
--- a/base/callback.h
+++ b/base/callback.h
@@ -23,13 +23,18 @@
//
// 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
//
@@ -270,7 +275,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)
+// 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
diff --git a/base/callback.h.pump b/base/callback.h.pump
index e236254..41d2ee9 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