Review Question
A=Answer
16. What is the referencing environment of a
statement?
A=The referencing environment of a statement is the collection of all variables that are visible in the statement. The referencing environment of a statement in a static-scoped language is the variables declared in its local scope plus the collection of all variables of its ancestor scopes that are visible.
A=The referencing environment of a statement is the collection of all variables that are visible in the statement. The referencing environment of a statement in a static-scoped language is the variables declared in its local scope plus the collection of all variables of its ancestor scopes that are visible.
17. What is a static ancestor of a subprogram? What
is a dynamic ancestor of a subprogram?
A=The static ancestors of a subprogram sub() are all the procedures in the program within which the procedure sub() is defined, i.e., the definition of the procedure sub() is nested. The definition of a procedure may be directly nested within only one procedure, called its static parent procedure. However, this static parent procedure may itself be nested within another procedure, and so on up to the main() program. All these procedures are considered to be static ancestors of the procedure sub(). Simply put, the static ancestors are those that strictly contain the subprogram in question.
The dynamic ancestors of a subprogram sub() are all the procedures called before sub() during the execution of a program, that have not yet finished executing. These are the procedures that are waiting for procedure sub() to finish executing before they can terminate. Simply put, dynamic ancestors are those that are called to reach the subprogram in question.
A=The static ancestors of a subprogram sub() are all the procedures in the program within which the procedure sub() is defined, i.e., the definition of the procedure sub() is nested. The definition of a procedure may be directly nested within only one procedure, called its static parent procedure. However, this static parent procedure may itself be nested within another procedure, and so on up to the main() program. All these procedures are considered to be static ancestors of the procedure sub(). Simply put, the static ancestors are those that strictly contain the subprogram in question.
The dynamic ancestors of a subprogram sub() are all the procedures called before sub() during the execution of a program, that have not yet finished executing. These are the procedures that are waiting for procedure sub() to finish executing before they can terminate. Simply put, dynamic ancestors are those that are called to reach the subprogram in question.
18. What is a block?
A=Such vari-ables are typically stack dynamic, so their storage is allocated when the section is entered and deallocated when the section is exited
A=Such vari-ables are typically stack dynamic, so their storage is allocated when the section is entered and deallocated when the section is exited
19. What is the purpose of the let constructs in
functional languages?
A=“let” introduces a new variable scope, and allows you to bind variables to values for that scope. It is often read as “let x be [value] in …”
A=“let” introduces a new variable scope, and allows you to bind variables to values for that scope. It is often read as “let x be [value] in …”
20. What is the difference between the names
defined in an ML let construct from the variables declared in a C block?
No comments:
Post a Comment