What is open recursion?

前端 未结 4 500
青春惊慌失措
青春惊慌失措 2021-02-01 16:34

What is open recursion? Is it specific to OOP?

(I came across this term in this tweet by Daniel Spiewak.)

4条回答
  •  余生分开走
    2021-02-01 17:27

    This paper analyzes the possibility of adding OO to ML, with regards to expressivity and complexity. It has the following excerpt on objects, which seems to make this term relatively clear –

    3.3. Objects

    The simplest form of object is just a record of functions that share a common closure environment that carries the object state (we can call these simple objects). The function members of the record may or may not be defined as mutually recursive. However, if one wants to support inheritance with overriding, the structure of objects becomes more complicated. To enable open recursion, the call-graph of the method functions cannot be hard-wired, but needs to be implemented indirectly, via object self-reference. Object self-reference can be achieved either by construction, making each object a recursive, self-referential value (the fixed-point model), or dynamically, by passing the object as an extra argument on each method call (the self-application or self-passing model).5 In either case, we will call these self-referential objects.

提交回复
热议问题