0:00 - 0:03Well that time we got it right but suppose we made a mistake.
0:03 - 0:06Suppose we had access to the global environment
0:06 - 0:08so this is actually defined,
0:08 - 0:10and instead of passing in the current environment,
0:10 - 0:15whenever we make a function, we're going to pass in the global environment instead.
0:15 - 0:17This is a bug. This is not correct.
0:17 - 0:20Let's try to reason forward about what might go wrong,
0:20 - 0:22and how we could see this bug or how it would behave.
0:22 - 0:25I'm going to write some statements and you're going to tell me which ones are true.
0:25 - 0:29Here I've written four claims, and in this multiple choice test
0:29 - 0:31I'd like you to note which ones are true.
0:31 - 0:36The first, no test input with only one function can show the bug.
0:36 - 0:39The second, we need at least three variables
0:39 - 0:42in the global environment to see the bug.
0:42 - 0:45Here--see the bug, show the bug, expose the bug--all mean the same thing.
0:45 - 0:48We can show the bug with only two functions,
0:48 - 0:51each of which is separately declared at the top level,
0:51 -and finally, we can show the bug with one function nested inside another function.
- 06-31 Mistakes
Other units in this course below:
To gain access to interactive quizzes, homework, programming assignments and a helpful community, join the class at http://www.udacity.com
- Video Language:
- CS262 - Programming Languages
|Amara Bot added a translation|