Names, Scopes, and Bindings Names, Scopes, and ... - Lrde - Epita
Names, Scopes, and Bindings Names, Scopes, and ... - Lrde - Epita
Names, Scopes, and Bindings Names, Scopes, and ... - Lrde - Epita
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Non Local Variables<br />
<strong>Bindings</strong><br />
Symbol Tables<br />
Complications<br />
Overloading<br />
Non Local Variables<br />
Lambda Shifting<br />
1 <strong>Bindings</strong><br />
2 Symbol Tables<br />
3 Complications<br />
Overloading<br />
Non Local Variables<br />
With nested functions<br />
int global;<br />
int outer (void)<br />
{<br />
int local, non_local;<br />
int inner (void)<br />
{<br />
return<br />
global + non_local;<br />
}<br />
return inner ();<br />
}<br />
Without<br />
int global;<br />
int outer_inner_ (int* non_local)<br />
{<br />
return global + *non_local;<br />
}<br />
int outer (void)<br />
{<br />
int local, non_local;<br />
return outer_inner_ (&non_local);<br />
}<br />
A. Demaille, R. Levillain <strong>Names</strong>, <strong>Scopes</strong>, <strong>and</strong> <strong>Bindings</strong> 46 / 55<br />
<strong>Bindings</strong><br />
Symbol Tables<br />
Complications<br />
Overloading<br />
Non Local Variables<br />
<strong>Bindings</strong><br />
Symbol Tables<br />
Complications<br />
Overloading<br />
Non Local Variables<br />
Non Local Variables<br />
Non Non Local Variables<br />
let<br />
function outer (): int =<br />
let<br />
non-local var outer := 0<br />
in<br />
let<br />
function inner () : int =<br />
let<br />
var inner := 1<br />
in<br />
inner + outer<br />
end<br />
in<br />
inner ()<br />
end<br />
end<br />
in<br />
outer ()<br />
end<br />
let<br />
in<br />
end<br />
let<br />
local var outer := 0<br />
in<br />
let<br />
in<br />
end<br />
end<br />
let<br />
var inner := 1<br />
in<br />
inner + outer<br />
end<br />
A. Demaille, R. Levillain <strong>Names</strong>, <strong>Scopes</strong>, <strong>and</strong> <strong>Bindings</strong> 47 / 55<br />
A. Demaille, R. Levillain <strong>Names</strong>, <strong>Scopes</strong>, <strong>and</strong> <strong>Bindings</strong> 48 / 55