Lesson 10.3: Semantic Issues of Variables: Scoping

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/23

encourage image

There's no tags or description

Looks like no tags are added yet.

24 Terms

1
New cards

Scope

range of statements in which the variable is visible

2
New cards

Scope

a variable is visible in a statement if it can be referenced in that statement

3
New cards

Block

section of code that may have their won stack-dynamic variables, and usually defines a scope

4
New cards

Local Variables

variables that are declared on the current block

5
New cards

Global Variable

can be accessed at any given point at any given time within the entirety of the program

6
New cards

Nonlocal Variable

variables that are visible to a block but is not declared there

7
New cards

Static and Dynamic Scoping

two types of scoping

8
New cards

Static scoping

scope of a variable is statically determined

9
New cards

Static scoping

allows the support for nested subprograms, program blocks and class definitions

10
New cards

Static parent

enclosing block where the current block is written

11
New cards

Static ancestor

all enclosing blocks of the current block

12
New cards

Enclosing block

every time a variable is used, the _ _ is checked

13
New cards

Static ancestor

if the variable is not found, the _ _ are searched

14
New cards

Dynamic Scoping

variable scope is determined by the sequence of calls to the subprograms

15
New cards

Dynamic Parent

the subprogram that called the current subprogram

16
New cards

Dynamic Ancestor

all subprogram calls that led to the current subprogram

17
New cards

Same Variable

variable name may not refer to the _ _, disadvantage of dynamic scoping (1)

18
New cards

Statistically

some attributes cannot be determined _, disadvantage of dynamic scoping (2)

19
New cards

Harder to read

source code may be _ _ _ , disadvantage of dynamic scoping (3)

20
New cards

Nonlocal variables

access to _ _ are slower, disadvantage of dynamic scoping (4)

21
New cards

Not Equal

Lifetime and Scope are _ _

22
New cards

Referencing Environment

collection of all variables visible in a statement

23
New cards

Only Once

named constants, variables bound to a value _ _

24
New cards

Initialization

binding of a value to a variable upon storage binding