Feb08 - CSE262: Programming Languages Instructor: Dr. Liang...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE262: Programming Languages Instructor: Dr. Liang Cheng Department of Computer Science and Engineering Lehigh University February 8, 2007
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/08/07 Outline ± Recap ± Binding (Section 5.4 of Chapter 5) ± Scope (Sections 5.8-5.10) ± Data types (Chapter 6) ± Summary and homework
Background image of page 2
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/08/07 You should now be able to … ± Describe various types of type binding and storage binding.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/08/07 Named Constants ± A variable that is bound to a value only once ± Improve the readability ± Using the name pi instead of the constant 3.1415926 ± Parameterize a program public static void main(String[] args){ final int len = 100; String[] strList = new String[ len ]; for ( int index = 0; index < len ; index ++) { } } variable: name, address, value , type, lifetime, scope Binding ± Concepts ± Type binding ± Storage binding
Background image of page 4
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/08/07 Outline ± Recap ± Binding (Section 5.4 of Chapter 5) ± Scope (Sections 5.8-5.10) ± Data types (Chapter 6) ± Summary and homework
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/08/07 Scope of a Variable ± The range of statements where a variable is visible or can be referenced ± Static scoping ± Algol 60, C, Pascal, C++, Java, Scheme, … ± Dynamic scoping ± LISP, Common LISP and Perl support both Scope ± Static scope ± Dynamic scope ± Scope and lifetime ± Referencing env variable: name, address, value, type, lifetime, scope
Background image of page 6
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/08/07 Static Scope ± Search process ± To connect a name reference to a variable, you (or the compiler) must find the declaration ± Search declarations, first locally, then in increasingly larger enclosing scopes, until one is found for the given name ± Enclosing static scopes (to a specific scope) are called its static ancestors ; the nearest static ancestor is called a static parent Scope ± Static scope ± Dynamic scope ± Scope and lifetime ± Referencing env variable: name, address, value, type, lifetime, scope
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/08/07 Dynamic Scope
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 28

Feb08 - CSE262: Programming Languages Instructor: Dr. Liang...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online