Similarly one procedure might call another procedure

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: H § ¥©¥ C £  ¡¦B¨ ¤ ¥ (¥) ¥ © T£ ¦% ¥3 @©9  § ¥©¥  £ G § ¢ ¥ ¦  ¥ "  §  ¡#!7%¡ ¨ ¢  £ ¥ RRR  S75 ¢ § P Q¡" H  £ ¨¥  §I6 H£ ¨¨¨ § ©¥ § ¥©¥ FG¥¦£ ¢  ¦& ¤ ¥ % ¢ ¥¦ ¤ ! B © %¨© £ ' © ¢ $ 3 & £ ¥  & ©¥ £   8 £ ¥¦E     ¥¦¨ ¤  ¥ £  ¡¥ )D$ ) & & C ( C £  ¡¦B¨ ¤ ¥ (¥) ¥ " A£ ¦% ¥3 ¥©¥ @ ©¥9  § ¢ 0  ¥ §  £ ¨ This style of communication is convenient when two procedures might share many quantities; one needs to assign only to the few quantities that change from one call to the next. Similarly, one procedure might call another procedure not directly but through a long chain of procedure calls. They could communicate data directly through a shared variable, without the intermediate procedures needing to know about it. Thus communication through a shared variable can be a kind of information hiding. 5 Another use of assignment is to create hidden state through the use of private variables. ¥©§ ¨¥ £ ©  X¥ £ ©  §  ©¥ § © £ ¥ £  ¢  ¨¥  I6 H ¥  P" Q7¡X6 H  £ ¨¥  ©¥ ¥ ©¨¨ ¥ ¥ £¥  £ © © ¥ £ ¨¥   ¨¥ ¢G § ¢¨ § C ¡) ( X!¡ §  ¢ 4  8  ¥ ¢ ¤  ©§ G " ¡" ( ( § H ¡" " ( 5¤ ¥ £ ( IT  §§6 ( Here the procedure keeps a private variable that stores the number of times has been called. In our language, the operands in a difference expression are evaluated left-to-right. Hence the first call to returns 1, the second call to returns 2, and the entire program has the value -1. ( ( [g = (proc−val (procedure d let d = ... ( Here is a picture of the environment in which is bound. )) ] [ counter = reference to location location for count ( We can think of this as the different invocations of sharing informatio...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern