Question

I have learned data-directed programming from the chapter 2.4 of the SICP, and then I continued to study the chapter 2.5. When I saw the "Tower of types" and "inherit", an thought flashed, is it an idea of OOP? Each package is an object and the "tower of types" shows the relation among the types which has the same meaning like "inherit" in OOP.

I am so excited and hope to know the answer!

Was it helpful?

Solution

Although section 2.5 does introduce the concept of type hierarchies, the "inheritance" mentioned is not as general as OOP's inheritance. In the context of a numeric tower, a type inherits all operations defined on a supertype, that's all.

In fact, in the second edition of SICP OOP is not treated formally - although I think I saw some SICP course notes dealing with OOP once, but they were not part of the book. The closest thing you get to OOP in SICP is the technique of message-passing, but without inheritance.

Check your Scheme interpreter's documentation, it's possible that some full-fledged object system is included within it - but it will have nothing to do with SICP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top