GO-V.ORG
As seen in

Call-by-push-value

In programming language theory, call-by-push-value (CBPV) is an intermediate language that embeds the call-by-value (CBV) and call-by-name (CBN) evaluation strategies. CBPV is structured as a polarized λ-calculus with two main types, "values" (+) and "computations" (-). Restrictions on interactions between the two types enforce a controlled order of evaluation, similar to monads or CPS. The calculus can embed computational effects, such as nontermination, mutable state, or nondeterminism. There are natural semantics-preserving translations from CBV and CBN into CBPV. This means that giving a CBPV semantics and proving its properties implicitly establishes CBV and CBN semantics and... Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

In programming language theory, call-by-push-value (CBPV) is an intermediate language that embeds the call-by-value (CBV) and call-by-name (CBN) evaluation strategies. CBPV is structured as a polarized λ-calculus with two main types, "values" (+) and "computations" (-). Restrictions on interactions between the two types enforce a controlled order of evaluation, similar to monads or CPS. The calculus can embed computational effects, such as nontermination, mutable state, or nondeterminism. There are natural semantics-preserving translations from CBV and CBN into CBPV. This means that giving a CBPV semantics and proving its properties implicitly establishes CBV and CBN semantics and properties as well. Paul Blain Levy formulated and developed CBPV in several papers and his doctoral thesis. Lambdas λx.M are computations of type A \to \underline{B} , where x : A and M : \underline{B} . A lambda application F V or V'F is a computation of type \underline{B} , where V : A and F : A \to \underline{B} . The let-binding construct let { x_1 = V_1; ... }. M binds values x_1 to values V_1 , of matching types A_1 , inside a computation M : \underline{B} . A thunk thunk M is a value of type U \underline{A} constructed from a computation M of type \underline{A} . Forcing a thunk is a computation, force X : \underline{A} for a thunk X : U \underline{A} . It is also possible to wrap a value V of type A as a computation return V : F A . Such a computation can be used inside another computation as M to x. N : \underline{B} , where M : F A , and N : \underline{B} is a computation. Values can also include algebraic data types constructed from a tag and zero or more sub-values, while computations include a deconstructing pattern-match match V as { (1,...) in M_1, ... } . Depending on presentation, ADTs may be limited to binary sums and products, Booleans only, or be omitted altogether. A program is a closed computation of type F A , where A is a ground ADT type. The CBN translation produces CBPV computations for each expression. A CBN function λx.M : A \to B translates unaltered, λx.M N : (U A^n) \to X^n . A CBN application M N : C is translated to a computation M v (thunk N v ) of type C^n . A pattern match match V as { (1,...) in M_1, ... } is translated similarly to CBN as V n to z in match z as { (1,...) in M_1 n , ... } . ADT values are wrapped with return , but force and thunk are also necessary on internal structure. Levy's translation assumes that M = force (thunk M) , which does indeed hold. It is also possible to extend CBPV to model call-by-need, by introducing a M need x. N construct that allows visible sharing. This construct has semantics similar to M name x. N = (λy.N[x ↦ (force y)])(thunk M) , except that with the need construct, the thunk of M is evaluated at most once.

source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Call-by-push-value". 1789363966. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1374821947

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·