notes50 - CS 61A Lecture Notes Week 8 Topic Local state...

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

View Full Document Right Arrow Icon
CS 61A Lecture Notes Week 8 Topic: Local state variables, environments Reading: Abelson & Sussman, Section 3.1, 3.2; OOP below the line We said the three big ideas in the OOP interface are message passing, local state, and inheritance. You know from section 2.4 how message passing is implemented below the line in Scheme, i.e., with a dispatch function that takes a message as argument and returns a method. This week we’re talking about how local state works. A local variable is one that’s only available within a particular part of the program; in Scheme this generally means within a particular procedure. We’ve used local variables before; let makes them. A state variable is one that remembers its value from one invocation to the next; that’s the new part. First of all let’s look at global state—that is, let’s try to remember some information about a computation but not worry about having separate versions for each object. ;;;;; In file cs61a/lectures/3.1/count1.scm
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online