05 NamesScopesAndBindings

05 NamesScopesAndBindings - COP 5555 Names Scopes and...

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

View Full Document Right Arrow Icon
COP 5555 Names, Scopes, and Bindings 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Names, Scopes and Bindings New topic Read Chapter 3 in Scott 2
Background image of page 2
Vocabulary A name is exactly what you think it is Most names are identifiers symbols (like '+') can also be names A binding is an association between two things, such as a name and the thing it names The scope of a binding is the part of the program (textually) in which the binding is active 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Binding Time the point at which a binding is created or, more generally, the point at which any implementation decision is made The next slide lists some possible binding times and typical examples 4
Background image of page 4
language design time program structure, primitive types language implementation time I/O, number of bits in primitive types, how arithmetic overflow is handled, type equality (if unspecified in manual) Remarks: Java attempts to define more at language design time than most languages for portability reasons, Motivated by the internet. Fixing decision at language design time may disallow architecture specific optimization 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
program writing time algorithms, names compile time plan for data layout link time layout of whole program in memory load time choice of physical addresses 6
Background image of page 6
run time value/variable bindings, sizes of strings run time subsumes program start-up time module entry time elaboration time (point a which a declaration is first "seen") procedure entry time block entry time statement execution time 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Static refers to things bound before run time Dynamic refers to things bound at run time “static” is a coarse term; so is "dynamic“ 8
Background image of page 8
Early binding times usually associated with greater efficiency compiled languages tend to have early binding times Later binding times associated with greater flexibility Interpreted languages tend to have later binding times 9
Background image of page 9

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

View Full DocumentRight Arrow Icon
Object lifetime and storage management Distinguish between names and objects to which they refer Key events creation of objects creation of bindings references to objects using the bindings (temporary) deactivation of bindings reactivation of bindings destruction of bindings destruction of objects 10 Remark: In this discussion, object just refers to anything that we want to bind to a name. This could be class, method, variable, type, etc. It is not necessarily an object as the term is used in OOP
Background image of page 10
Object lifetime and storage management Distinguish between names and objects to which they refer Key events creation of objects creation of bindings references to objects using the bindings (temporary) deactivation of bindings reactivation of bindings destruction of bindings destruction of objects 11
Background image of page 11

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

View Full DocumentRight Arrow Icon
The lifetime of a binding is the period of time from creation to destruction If an object outlives binding it is garbage If binding outlives object it is a dangling reference The scope of a binding is the region of the program in which the binding is active 12
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/09/2009 for the course COP 5555 taught by Professor Staff during the Fall '08 term at University of Florida.

Page1 / 124

05 NamesScopesAndBindings - COP 5555 Names Scopes and...

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

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