diff options
Diffstat (limited to 'base/callback.h')
-rw-r--r-- | base/callback.h | 17 |
1 files changed, 11 insertions, 6 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 |