Com S 641 meeting -*- Outline -*- * extent (4.3) ** terms ------------------------------------------ EXTENT or LIFETIMES (4.3) def: The *extent* of a binding is A bindings extent is can be either: indefinite = dynamic = ALTERNATIVES scope binding \ extent indefinite dynamic lexical dynamic ------------------------------------------ ... how long it is retained (in time) ...as long as needed (as in a closure, the bindings are kept) ... discarded when leave the binding form (as in dynamic scoping) ... static dynamic assignment (= fluid binding) (global vars) dynamic scope ** dangling references ------------------------------------------ DANGLING REFERENCES AND OTHER FORMS OF ESCAPE Why is it okay to free storage allocated at the time of exit from a block? Examples: /* some C code */ int * hmm() { int i = 0; return &i; } begin proc P = begin var A: newint; proc Q(X:int exp) = A := X in Q end in (call P)(Q) ------------------------------------------ The second of these is the "funarg" problem when considered with dynamic scoping