Return to Video

06-31 Mistakes

  • 0:00 - 0:03
    Well that time we got it right but suppose we made a mistake.
  • 0:03 - 0:06
    Suppose we had access to the global environment
  • 0:06 - 0:08
    so this is actually defined,
  • 0:08 - 0:10
    and instead of passing in the current environment,
  • 0:10 - 0:15
    whenever we make a function, we're going to pass in the global environment instead.
  • 0:15 - 0:17
    This is a bug. This is not correct.
  • 0:17 - 0:20
    Let's try to reason forward about what might go wrong,
  • 0:20 - 0:22
    and how we could see this bug or how it would behave.
  • 0:22 - 0:25
    I'm going to write some statements and you're going to tell me which ones are true.
  • 0:25 - 0:29
    Here I've written four claims, and in this multiple choice test
  • 0:29 - 0:31
    I'd like you to note which ones are true.
  • 0:31 - 0:36
    The first, no test input with only one function can show the bug.
  • 0:36 - 0:39
    The second, we need at least three variables
  • 0:39 - 0:42
    in the global environment to see the bug.
  • 0:42 - 0:45
    Here--see the bug, show the bug, expose the bug--all mean the same thing.
  • 0:45 - 0:48
    We can show the bug with only two functions,
  • 0:48 - 0:51
    each 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.
Title:
06-31 Mistakes
Description:

Other units in this course below:
Unit 1:http://www.youtube.com/playlist?list=PL3FEF9299137945CC
Unit 2:http://www.youtube.com/playlist?list=PLBF6FC32358457242
Unit 3:http://www.youtube.com/playlist?list=PL30EF9EB86B4D2E54
Unit 4:http://www.youtube.com/playlist?list=PL6881C8D2E9D63242
Unit 5:http://www.youtube.com/playlist?list=PL62AF1F6D3B654E14
Unit 6:http://www.youtube.com/playlist?list=PL8FCC9D9C45A6640E
Unit 7:http://www.youtube.com/playlist?list=PL9533BCB71FD88E38

Q&A: http://www.youtube.com/playlist?list=PLE0EB375FA373A866

To gain access to interactive quizzes, homework, programming assignments and a helpful community, join the class at http://www.udacity.com

more » « less
Video Language:
English
Team:
Udacity
Project:
CS262 - Programming Languages
Duration:
0:58
Amara Bot added a translation

English subtitles

Revisions