Why is it called "open (or closed) recursion?

后端 未结 1 595
甜味超标
甜味超标 2021-02-12 18:42

I found some explanations of open/closed recursion, but I do not understand why the definition contains the word \"recursion\", or how it compares with dynamic/static dispatchin

1条回答
  •  一生所求
    2021-02-12 19:18

    I tried to start writing an answer here and then ended up writing an entire blog post about it. The TL;DR is:

    So, if you compare a real object-oriented language to a simpler language with just structures and functions, the differences are:

    • All of the methods can see and call each other. The order they are defined doesn’t matter since their definitions are “simultaneous” or mutually recursive.
    • The base methods have access to the derived receiver object (i.e. this or self in other languages) so they don’t close over just each other. They are open to overridden methods.

    Thus: open recursion.

    0 讨论(0)
提交回复
热议问题