正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 14.5.9 Recall that the body of make-professor has within it aHow the internal object works let expression. You have seen that evaluating a let will cause a new frame to be created that is scoped by the current frame. Within that frame, we bind int-person to some value. Thus, frame E2 is created by the evaluation of the let within make-professor, and is scoped by el How the internal object works Slide 14.5.10 and what is int-person bound to?... to the result of evaluating (make-person ) And we know what that does as we saw it earlier. It creates a new frame through the application of make-person and notice that this frame is oped by the global environment, because that is where the tise e tnake-wro fessor make-person procedure's environment pointer points to Within that frame we bind the variable fname to the argument dnm上pr【 passed in, and relative to that frame we evaluate the body of make-per corresponding to an instance of a person. Int-person is then bound to this object, as that is the value returned by the application of make-person Slide 14.5.11 How the internal object works Finally, we evaluate the body of the let expression inside make-professor, with respect to E2 (remember that was the frame created by evaluating the first part of the let). That creates the message-passing object corresponding to an instance of a person. It's environment pointer points to this frame, and the procedure is the value returned by the application of make 丑 e inake-pro te那nrec‘gr1msn professor. Therefore, e is bound to this value in the global environment This has a structure that is very useful in our system! sor nect twith as internal peho6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 14.5.9 Recall that the body of make-professor has within it a let expression. You have seen that evaluating a let will cause a new frame to be created that is scoped by the current frame. Within that frame, we bind int-person to some value. Thus, frame E2 is created by the evaluation of the let within make-professor, and is scoped by E1. Slide 14.5.10 ... and what is int-person bound to? … to the result of evaluating (make-person ...). And we know what that does as we saw it earlier. It creates a new frame through the application of make-person and notice that this frame is scoped by the global environment, because that is where the make-person procedure's environment pointer points to. Within that frame we bind the variable fname to the argument passed in, and relative to that frame we evaluate the body of make-person which returns a message-passing object corresponding to an instance of a person. Int-person is then bound to this object, as that is the value returned by the application of make-person. Slide 14.5.11 Finally, we evaluate the body of the let expression inside make-professor, with respect to E2 (remember that was the frame created by evaluating the first part of the let). That creates the message-passing object corresponding to an instance of a person. It's environment pointer points to this frame, and the procedure is the value returned by the application of make￾professor. Therefore, e is bound to this value in the global environment. This has a structure that is very useful in our system!
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有